Need help with script

I’m trying to get the players leaderstats and display them with in a text gui but it’s not working. (the script is in a text label)

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local PlayerStone = player:WaitForChild("leaderstats"):WaitForChild("Stone")

while wait() do
	script.Parent.Text = PlayerStone
end
1 Like
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local PlayerStone = player:WaitForChild("leaderstats"):WaitForChild("Stone")

PlayerStone:GetPropertyChangedSignal("Value"):Connect(function()
   script.Parent.Text = PlayerStone.Value
end)
3 Likes

Put .Value at the end

local Players = game:GetService("Players")
local player = Players.LocalPlayer

while wait() do
	local PlayerStone = player:WaitForChild("leaderstats"):WaitForChild("Stone")

	script.Parent.Text = PlayerStone.Value
end

It says attempt to index nil with ‘WaitForChild’

Have you made sure it’s a LocalScript? Players.LocalPlayer can only be accessed on the client.

I just fixed it right there. So yeah

1 Like