Leaderstat GUI not working

Today i tried to make leaderstat GUI, it wasn’t working, Does anybody know why?

while wait() do
	script.Parent.Text = "Steps: "..game.Players.LocalPlayer.leaderstats:WaitForChild("Steps").Value
end

Maybe define the player as a variable such as:

local player = game.Players.LocalPlayer

And also add a WaitForChild() for the leaderstats, like:

player:WaitForChild("leaderstats")

Like that?

while wait() do
	local player = game.Player.LocalPlayer
	player:WaitForChild("leaderstats")
	script.Parent.Text = "Cash: "..game.Players.LocalPlayer.leaderstats:WaitForChild("Cash").Value
end

Well if you’re trying to make a GUI that shows the player’s cash then add a local script into your textlabel and write the following code :

local player = game.Players.LocalPlayer

local cash = player:WaitForChild("leaderstats"):WaitForChild("Cash")

script.Parent.Text = "Cash: "..cash.Value

cash.Changed:Connect(function()
    script.Parent.Text = "Cash: "..cash.Value
end)

ok I think that’s all

show the output when you run the game (to do this click the “view” icon in the top bar then “output” and it will show you the errors post them here too so we know whats going wrong with your script)

Thank you. it works propertly.

1 Like