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

How do I make an updated leaderboard?

My leaderboard Value is the Weight's Level. But it won't update, even if the Weight's Value grow, the leaderboard's Value doesn't grow. It's because the leaderboard's Value was set when the Weight's Value was 1. I want to make an updated leaderboard so that when the weight updates ( grow ), the leaderboard also updates ( grow ). Here is my script for some infos:

local level = Instance.new("NumberValue")
	level.Name = "Level"
	level.Parent = leaderstats
	level.Value = game.StarterPack.Weight.Level.Value

So I created the leaderboard but when the game.StarterPack.Weight.Level.Value changes, the leaderboard doesn't. Thank you for reading this, please help me because I need to know how to make this to make my game.

1 answer

✓ Accepted answer
game.Players.PlayerAdded:Connect(function(player)  -- You have to have the player
local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
local level = Instance.new("NumberValue")
    level.Name = "Level"
    level.Parent = leaderstats
    level.Value = player.Backpack.Weight.Level.Value

player.Backpack.Weight.Level.Value.Changed:Connect(function() -- Function when changed.
level.Value = player.Backpack.Weight.Level.Value
end)
end)

Everything in StarterPack is replicated to the player's backpack, so you need to get it from there. I didn't test this, so there are probably errors in it. I hope you get the idea.

1 comment

0

or you can also use GetPropertyChangedSignal but yeah, I'll accept your answer

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