function fire()
if ammo > 0 then
ammo = ammo - 1
local missile = Instance.new("Part", workspace)
missile.Name = player.Name .. "missile"
missile.FormFactor = "Custom"
missile.BrickColor = BrickColor.new("Black")
missile.Size = Vector3.new(2, 0.5, 0.5)
missile.TopSurface = "Smooth"
missile.BottomSurface = "Smooth"
missile.CanCollide = false
missile.CFrame = gun.Handle.CFrame
missile.CFrame = CFrame.new(missile.Position, mouse.Hit.p)
local velocity = Instance.new("BodyVelocity", missile)
velocity.velocity = missile.CFrame.lookVector * 90
velocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
game.Debris:addItem(missile, 5)
wait(firingTime)
end
end
I'm having trouble making the player wait before he/she can fire the rocket again.
I've tried putting it at the start of the conditional statement, and all it does is wait 'firingTime' before the rocket is fired.
I've tried putting it at the end of the conditional statement, it doesn't do anything.
I've tried putting it after the conditional statement, doesn't do anything.
I want to wait, before the rocket can be fired again.
Any suggestions? |