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.
It is not in a local script if it shows that error.
game.Players.LocalPlayer
Can only be found using a local script.