This is the code:
local player = game.Players.LocalPlayer local leaderstats = player:WaitForChild("leaderstats") local tokens = leaderstats:WaitForChild("Cash") local text = script.Parent
while true do text.Text = "????: "..Cash.Value" end
It doesnt show the value in the gui. ???? is an emoji
You have unnecceessary string symbol ("
) on line after while true do
:
-- you have: text.Text = "????: "..Cash.Value" -- should be: text.Text = "????: "..Cash.Value -- here no "
Your script probably gives you time exhaustion
error because you have while true do
loop without a debounce, that means it will run infinitely with speed of sonic and crash your script, to prevent that you would use wait
:
... while true do text.Text = '????: ' .. Cash.Value wait(1) -- waits one second end
But i have too much reputation to show you this method, GetPropertyChangedSignal is what you need, it's a function of Instance
which returns an Event
which fires when given Property
changes, you would then connect it to the function so last part of your script would look like this:
... local function Update() text.Text = '????: ' .. Cash.Value end --/This will fire every time value of cash changes Cash:GetPropertyChangedSignal('Value'):Connect(Update) Update() -- update for the first time