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

My custom leaderstat GUI shows this error, is it broken? [Answered]

So, I was making a script for a custom GUI. It says this: Players.1ov3y0u.PlayerGui.Stats GUI.Diamonds.Script:3: attempt to index local 'player' (a nil value) Player is my variable as shown in this code:

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

And then I was wondering why it wasn't working, I did everything right. I'm not sure if it's broken or not. I don't know why it's doing that, and this is the only method I know how to make a custom leaderstats.

1 comment

0

Instead of player, use plr. btw

1 answer

It is not in a local script if it shows that error.

game.Players.LocalPlayer

Can only be found using a local script.

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