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

How can i make jump counter to leaderboards in my game?

Asked by 2 years ago

I am just doing parkour game and i can't understand how to do it.

0
Do you have any script or anything theking66hayday 841 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

Here is the code:

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

    local jumps = Instance.new("IntValue", leaderstats)
    jumps.Name = "Jumps"
    jumps.Value = 0

    player.CharacterAdded:Connect(function(character)
        local humanoid = character:WaitForChild("Humanoid")
        humanoid.StateChanged:Connect(function(_, newState)
            if newState.Name == "Freefall" then
                jumps.Value += 1
            end
        end)
    end)
end)
0
Thank you so much! I really appreciate that. SoftBlueApple 12 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Create a value inside starterpack and just create a script that detects when the player jumps and adds 1 to the value remember to post question for help this is to help with errors not entire systems

0
Oh ok, i will try. SoftBlueApple 12 — 2y
0
I don't think i can do that, but i tried something as well, i added NumberValue to StarterPack named: Jumps. And then i made Script in ServerScriptService but it's not working: game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) if char:WaitForChild("Humanoid").JumpPower == true then player.leaderstats.Points.Value = player.leaderstats.Points.Value SoftBlueApple 12 — 2y
0
Are you getting an error? TheMiniMagic_YT 27 — 2y
0
Nope, but it's just not working, i checked output and it says nothing. SoftBlueApple 12 — 2y

Answer this question