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

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

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)

1 comment

0

You need to figure out how to see if the player jumps, and then add +1 to the Jump value

1 answer

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)

1 comment

0

I tried doing this but it just changes jump to 0

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