Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Roblox Update Broke Jump Delay, Any of you can fix it?


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?

3 comments

0

Shouldn't time() be wait()?

0

tick(), I think, not wait(), nor time().

0

I've tried tick() still It doesn't work.

1 answer

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).

This discussion is preserved as it was. New answers, comments, and votes are closed.