local TimeBetweenJumps = 2; -- Time in seconds. local Player = game.Players.LocalPlayer repeat wait() until Player.Character ~= nil; local Character = Player.Character --repeat wait() until Character:FindFirstChild("Humanoid") local Humanoid = Character:WaitForChild("Humanoid"); local LastJump = time(); Humanoid.Changed:connect(function() if Humanoid.Jump then if time()-LastJump >= TimeBetweenJumps then LastJump = time(); else Humanoid.Jump = false; end end end)
This was working for 3 months now but awhile ago It broke and can't jump anymore.... Any of you can fix it?
I needed to add repeat wait() until game.Players.LocalPlayer
in the 2nd line, but outside of that the script worked for me as is.
@the comments of the question (I cannot comment): tick() and time() can both work here, though they will give slightly different behaviour when the place is having trouble keeping up to the demands of scripts. tick() gives "number of seconds since the Unix epoch, January 1st, 1970" while time() gives "the current place time in seconds. Place time only updates during wait() and must be synchronized across network."
In other words, tick() will give a real-time 2 second delay, whereas time() will give an in-game 2 second delay (which might take longer real time if the place is lagging).