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

Leaderboard points make you jump higher?

Asked by 4 years ago
Edited 4 years ago

Hello, I've recently need a script that changes their Jump power by their stats.

So lets say a players energy (My point system) is 100, the player would have their jump power. I need it so this loads when the player joins the game as my leaderboard saves and everytime they get a point.

This is my script to give the point to the player.

remote.OnServerEvent:Connect(function(Player)
    local plr = Player
    plr.leaderstats.Energy.Value = plr.leaderstats.Energy.Value +1
end

Thanks!

0
post a script 3wdo 198 — 4y

1 answer

Log in to vote
1
Answered by
parkour 20
4 years ago
Edited 4 years ago

To change how high a player jumps, you have to locate their character and edit the Humanoid's JumpPower.

I've added the line of code for you, however you can edit it any way you would like.

remote.OnServerEvent:Connect(function(Player)
    local Character = Player.Character
    Player.leaderstats.Energy.Value = Player.leaderstats.Energy.Value +1

    if Character then
        if Character:FindFirstChild("Humanoid") then
            Character.Humanoid.JumpPower = Player.leaderstats.Energy.Value + 50 -- 50 is the default jump power, so if their energy is 0 they can still jump normally.
        end
    end
end
0
Watch out for the typo on line 6. It was spelled "FidnFirstChild" lol User#29793 0 — 4y
0
My bad, edited. parkour 20 — 4y
Ad

Answer this question