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

Can't make the leaderboard display the players jump height?

If you can answer this it would be really helpful if you included a script.

function playerAdded(plr)

   local stats = Instance.new("IntValue", plr)
   stats.Name = "leaderstats"

   local money = Instance.new("IntValue", stats)
   money.Name = "Jump Power"
   money.Value = game.Players.plr.Character.Humanoid.JumpPower

end

game.Players.PlayerAdded:connect(playerAdded)

2 answers

✓ Accepted answer

Hello, jalbraek!

Try this:

function playerAdded(plr)

	repeat wait() until plr.Character --Waits for player character

    local stats = Instance.new("Folder") --Leaderstats is a folder, not a IntValue and the Parent property of the Instance.new is deprecated.. you should not use it
    stats.Name = "leaderstats"
    stats.Parent = plr

    local money = Instance.new("IntValue") -- The parent property of the Instance.new is deprecated.. you should not use it
    money.Name = "Jump Power"
    money.Value = plr.Character.Humanoid.JumpPower
    money.Parent = stats

    plr.Character.Humanoid.Changed:Connect(function() --Makes it update on changed
        money.Value = plr.Character.Humanoid.JumpPower
    end)

end

game.Players.PlayerAdded:connect(playerAdded)

Note: Don't post duplicate questions!

Good Luck with your games

3 comments

0

Nice answer, but you put connect on line 20, which is deprecated, I'm just reminding jalbraek to change connect to Connect if he copied your code.

0

It wasn't me, it was on the code, i just forgot to edit it '-'

0

Lol, its all good!

Hi!

You seem to be using a lot of deprecated functions, such as Instance.new("IntValue", plr). You should use: local int = Instance.new("IntValue") int.Parent = plr. Same goes for stats and connect (should be Connect, with the capital C)

Anyways, try this:

function playerAdded(plr)

   local stats = Instance.new("IntValue")
   stats.Parent = plr
   stats.Name = "leaderstats"

   local money = Instance.new("IntValue")
   money.Parent = stats
   money.Name = "Jump Power"
   money.Value = game.Workspace:WaitForChild(plr.Name).Humanoid.JumpPower

end

game.Players.PlayerAdded:Connect(playerAdded)

I hope this helped!

1 comment

0

How can I make this update to your current Jump Power because currently it doesn't.

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