Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with a jump leaderboard?

Asked by 1 year ago

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

Log in to vote
0
Answered by 1 year ago

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.

Ad

Answer this question