I was trying to do a GUI like in a simulator, the ones where it shows how many coins you have. Here is my script:
local cashHolder = game.StarterGui.StatGUI.Points local Lplayer = game.Players.LocalPlayer local leaderstats = Lplayer.leaderstats.Points while true then do local cashHolder.Text = Lplayer.leaderstats wait(0.5) end
Can someone please tell me why it is not working? Thank you!
You shouldn't have local when changing text at line 6 and wrong defining it should be like this
cashHolder.Text = leaderstats.Value
and and you are defining cashholder from startergui, switch first line with
local cashHolder = game.Players.LocalPlayer.PlayerGui:WaitForChild("StatGUI").Points
local cashHolder = game.StarterGui.StatGUI.Points local Lplayer = game.Players.LocalPlayer local leaderstats = Lplayer.leaderstats.Points.Value while true do cashHolder.Text = Lplayer.leaderstats wait(0.5) end
The issue: cashHolder is already defined, so don't use local for editing somethings property or interacting with defined variables, don't worry, it's a common mistake. And also it's 'while true do', not 'while true then do'!