I’m pretty new to Roblox Studios scripts so I started out by doing a simulator tutorial so I can learn how scripts function. I had already had the selling, earning points to sell, and leaderboards stuff setup when I tried tackling displaying the players score “Sugar” on a ScreenGUI. But when I tried coding the script to display the players “Sugar”, I was hit with a error that said that [Players.LightGuardian9.PlayerGui.Main.Sugar.ShowSugar:3: attempt to index nil with ‘WaitForChild’]. Am I doing something wrong in my script? I tried rewriting it multiple times but still got nothing.
--
while wait() do
local player = game.Players.LocalPlayer
script.Parent.Text = "🍭"..player:WaitForChild("leaderstats"):FindFirstChild("Sugar").Value
end