I'd like the player to have to wait to be able to fire again for .2 seconds, that's how long the animation is, how would I do that?
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
tool.Equipped:connect(function(mouse)
print("Tool Equipped")
mouse.Button1Down:connect(function()
print("Mouse pressed!")
local ray = Ray.new(tool.BulletExit.CFrame.p,(mouse.Hit.p - tool.BulletExit.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Really black")
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Transparency = 0.25
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
local distance = (tool.BulletExit.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(tool.BulletExit.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
game:GetService("Debris"):AddItem(beam, 0.1)
if part then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
humanoid:TakeDamage(15)
end
end
end)
end)

3 comments
I've tried using the wait (.25) command in multiple spots where I thought it would work, but no success.
Use a debounce - http://wiki.roblox.com/?title=Debounce#Use_case
Thanks