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

I need help with a jump leaderboard?

Hey huys, I have this script:*

game.Players.PlayerAdded:Connect(function(player)
		    local leaderstats = Instance.new("Folder")
		    leaderstats.Name = "leaderstats"
		    leaderstats.Parent = player 

		    local jumpCount = Instance.new("IntValue")
		    jumpCount.Name = "Jumps"
		    jumpCount.Parent = leaderstats

		    player.CharacterAdded:Connect(function(character) 

		    local humanoid = character:WaitForChild("Humanoid")
		    local debounce = true

		    humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
		    if debounce == true then
		    debounce = false
		    if humanoid.Jump == true then
		    jumpCount.Value = jumpCount.Value + 1
		    end
		    wait(0.2)
		    debounce = true 
		    end
	    end)
    end)
end)

And my problem is, when I spam the spacebar, the leaderboard increases when the character has not made all his jumps (for example: I spam 10 times so the leaderboard is at 10 but the character has only made 5 jumps in the game) I hope someone can help me !

1 answer

Obviously, the jump wait time (.2) is obviously not enough time. The whole duration of a jump is about 520 Milliseconds (.52 Seconds). This does not count for higher jump power, or/and higher jump height.

I'm in a rush so no time to explain it well, and might get stuff completely wrong. If this doesn't help, don't mind it.

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