Flash Bang
Flash Bang
Flash Grenade
Blinds anyone unfortunate enough to be near it.
--]]
function CheckPlayer()
if Player.Character == nil then return false end
if Player.Character:FindFirstChild("Torso") == nil or
Player.Character:FindFirstChild("Right Arm") == nil or
Player.Character:FindFirstChild("Humanoid") == nil then return false end
if Player.Character.Humanoid.Health <= 0 then return false end
return true
end
function tagHumanoid(humanoid)
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Value = Player
tag.Parent = humanoid
local tag = Instance.new("StringValue")
tag.Name = "creatorType1"
tag.Value = Name
tag.Parent = humanoid
local tag = Instance.new("StringValue")
tag.Name = "creatorType2"
tag.Value = "blown up"
tag.Parent = humanoid
end
function playSound(id,parent,volume,pitch)
local sound = Instance.new("Sound",parent or workspace)
sound.SoundId = "http://www.roblox.com/asset?id="..id
sound.Volume = volume or 1
sound.Pitch = pitch or 1
coroutine.wrap(function()
wait()
sound:Play()
wait(10)
sound:Stop()
sound:Destroy()
end)()
return sound
end
function CreateParts(Parent, Format)
if Parent == nil then return end
local Parts = Instance.new("Model")
Parts.Name = ModelName
if Format == 1 then
Parts.Name = Parts.Name.. " (Holstered)"
end
Parts.Parent = Parent
function onButton1Down(Mouse)
if Button1Down == true then return end
Button1Down = true
if CheckPlayer() == false or Primed == true or Thrown == true or CanUse ==
false then return end
CanUse = false
Primed = true
playSound(2697295,Player.Character.Torso,1,1)
pcall(function() Player.Character[ModelName].Pin.Weld:Remove() end)
for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
pcall(function()
if string.match(Part.Name, "Pin") then
Part.CanCollide = true
end
end)
end
Instance.new("Configuration", Player.Character[ModelName].Handle).Name =
"CanExplode"
function explode()
MaxDistance = 50
wait(4)
local Sound = Instance.new("Sound")
Sound.Name = "Bang"
Sound.SoundId = "rbxasset://sounds/collide.wav"
Sound.Volume = 1
Sound.Pitch = 3
Sound.Parent = Handle
Sound:Play()
game:GetService("Debris"):AddItem(Sound, 0.1)
local Part = Instance.new("Part",Handle)
Part.Name = "Bang"
Part.BrickColor = BrickColor.new("Institutional white")
Part.TopSurface = 0
Part.BottomSurface = 0
Part.CanCollide = false
Part.Anchored = true
Part.FormFactor = "Custom"
Part.Size = Vector3.new(1, 1, 1)
Part.CFrame = Handle.CFrame
Instance.new("SpecialMesh", Part).MeshType = "Sphere"
coroutine.wrap(function()
for i = 0, 1, 0.15 do
Part.Mesh.Scale = Vector3.new(i, i, i) * (MaxDistance + 5)
Part.Transparency = i
wait()
end
Part:Remove()
end)()
local Smoke = Instance.new("Smoke", Handle)
Smoke.Color = Color3.new(0.8, 0.8, 0.8)
Smoke.Size = 15
Smoke.RiseVelocity = 10
Smoke.Opacity = 0.2
for _, Player in pairs(game:GetService("Players"):GetPlayers()) do
if Player.Character ~= nil then
if Player.Character:FindFirstChild("Head") ~= nil then
local Distance = (Player.Character.Head.Position -
Handle.Position).magnitude
if Distance < MaxDistance then
local StunGui = Instance.new("ScreenGui", Player.PlayerGui)
StunGui.Name = "StunGui"
local White = Instance.new("Frame", StunGui)
White.Name = "White"
White.BorderSizePixel = 0
White.BackgroundColor3 = Color3.new(1, 1, 1)
White.Size = UDim2.new(2, 0, 2, 0)
White.Position = UDim2.new(-0.5, 0, -0.5, 0)
coroutine.wrap(function()
wait(((MaxDistance - Distance) / MaxDistance) * 5)
for i = 0, 1, (Distance / MaxDistance) * 0.01 do
White.BackgroundTransparency = i
wait()
end
StunGui:Remove()
end)()
end
end
end
end
wait(1)
Smoke.Enabled = false
wait(5)
Handle:Remove()
end
Player.Character[ModelName].Changed:connect(function(Property)
if Property == "Parent" then
while CanUse == false do wait() end
EnableLimb(1, Player.Character)
--UpdateFirstPerson()
script.Parent:Remove()
end
end)
CanUse = true
end
function onButton1Up(Mouse)
if Button1Down == false then return end
Button1Down = false
if CanUse == false then return end
if Player.Character:FindFirstChild(ModelName) ~= nil and Thrown == false then
Thrown = true
SetSpeed(1, 0.75, Player.Character)
SetAngle(1, 0, Player.Character)
wait()
pcall(function() Player.Character[ModelName].Handle.Weld:Remove() end)
for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
pcall(function() Part.CanCollide = true end)
end
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.velocity = (Mouse.Hit.p -
Player.Character[ModelName].Handle.Position).unit * 75
BodyVelocity.Parent = Player.Character[ModelName].Handle
game:GetService("Debris"):AddItem(BodyVelocity, 0.1)
game:GetService("Debris"):AddItem(Player.Character[ModelName], 16)
Player.Character[ModelName].Parent = Workspace
wait(1)
explode()
end
end
function onSelected(Mouse)
if Selected == true or CanUse == false then return end
CanUse = false
while true do
if CheckPlayer() == true then
if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil
then
break
end
end
wait(0.1)
end
Selected = true
RemoveParts(Player.Character, 1)
CreateParts(Player.Character, 2)
DisableLimb(1, Player.Character)
SetSpeed(1, 0.5, Player.Character)
SetAngle(1, math.rad(200), Player.Character)
Mouse.Icon = "rbxasset://textures\\GunCursor.png"
Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
CanUse = true
end
function onDeselected(Mouse)
if Selected == false or Primed == true then return end
Selected = false
while CanUse == false do wait() end
if Selected == true then return end
CanUse = false
RemoveParts(Player.Character, 2)
CreateParts(Player.Character, 1)
SetAngle(1, 0, Player.Character)
ResetLimbCFrame(1, Player.Character)
EnableLimb(1, Player.Character)
CanUse = true
end
end