I've made a keydown script that whenever you press the letter E, a fireball shoots from your hand. The problem is i wanted to add a wait time between every fireball being shot but whenever i tried adding a wait, the script broke or did not work properly. Can someone help me out with that?
You need to do a debounce. For example, here's a little thing I did.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local debounce = false mouse.KeyDown:connect(function(key) if key == "e" then if debounce == false then -- When a key is pressed, check if debounce is set to False, if it is set to true then it will not run. debounce = true -- Makes it so the script is disabled. local part = Instance.new("Part", game.Workspace) -- Creates a part. wait(2) -- The wait time. part:Destroy() debounce = false -- Reset the debounce to false, the player can press E again. end end end