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

I made a leaderboard connected to a characters jumpPower. Why won't it update?

Asked by 6 years ago

Whenever JumpPower on the character is increased the leaderboard doesn't update. Is there something i'm missing?

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)

        local leaderstats = Instance.new('Folder')
        leaderstats.Name='leaderstats'
        leaderstats.Parent = player

        local jumpPower = character.Humanoid.JumpPower

        local height = Instance.new('IntValue')
        height.Value = 0
        height.Parent = leaderstats
        height.Name = 'Height'

        local jump = Instance.new('IntValue')
        jump.Value = jumpPower
        jump.Parent = leaderstats
        jump.Name = 'Jump'

    end)
end)
0
You need to figure out how to see if the player jumps, and then add +1 to the Jump value Vxpper 101 — 6y

1 answer

Log in to vote
0
Answered by
tantec 305 Moderation Voter
6 years ago

Ok, so when you put the character's jumppower into a variable, it only stores the current jumppower it is at when you create that variable, it doesn't update it, so to fix this you should directly use the characters jumppower like this. Also you should do a :Changed() function

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)

        local leaderstats = Instance.new('Folder')
        leaderstats.Name='leaderstats'
        leaderstats.Parent = player

        local jumpPower = character.Humanoid.JumpPower

        local height = Instance.new('IntValue')
        height.Value = 0
        height.Parent = leaderstats
        height.Name = 'Height'

        local jump = Instance.new('IntValue')
        jump.Value = character.Humanoid.JumpPower 
        jump.Parent = leaderstats
        jump.Name = 'Jump'

    character.Humanoid.Changed:connect(function(what) -- everytime it changes yeah
        if what == "JumpPower" then
            jump.Value = what.Value
        end
    end)

    end)
end)
0
I tried doing this but it just changes jump to 0 FizzyFlame 42 — 6y
Ad

Answer this question