This script is in a text label and is supposed to show the player his Money from the leaderboard. But this script does not work and the output isn't putting up errors. Please help
game.Players.PlayerAdded:connect(function(player) wait(1) player:WaitForDataReady() repeat wait() until player:FindFirstChild("leaderstats") if player.DataReady then if player:findFirstChild("leaderstats") then local Money = player.leaderstats.Money script.Parent.Text = Money end end end)
I see what you are trying to do, but you do not need all those checks and waits.
You need to define the Player and Leaderstats:
local TextLabel = script.Parent local Player = TextLabel.Parent.Parent.Parent.Parent local Stats = Player:WaitForChild('leaderstats')
Second, you need to create a change event and function:
Stats:WaitForChild('Money')Changed:connect(function() end)
Third step is to code the change:
TextLabel.Text = stats.Money.Value
Last thing, is to put that all together:
local TextLabel = script.Parent local Player = TextLabel.Parent.Parent.Parent.Parent local Stats = Player:WaitForChild('leaderstats') Stats:WaitForChild('Money')Changed:connect(function() TextLabel.Text = stats.Money.Value end)