Hello, I am trying to make so that a GUI shows hw much cash you have why is it not working? gives me no error just won’t change the text. And btw i put the while loop there cause it has to keep updating or is there another way to do smarter?
local cashLabel = game.StarterGui.Stats.CashLabel
local stoneLabel = game.StarterGui.Stats.StoneLabel
local player = game.Players.LocalPlayer
local CashValue = player.leaderstats.Cash.Value
local StoneValue = player.leaderstats.Stone.Value
while true do
wait(0.1)
cashLabel.Text = "Cash:"..CashValue
end
You changing the gui version that is stored on StarterGui, not the cloned to PlayerGui
By local CashValue = player.leaderstats.Cash.Value
you getting value only one time, get instance without .Value (local CashValue = player.leaderstats.Cash)
Use .Changed event instead of loop
local player = game.Players.LocalPlayer
local CashValue = player.leaderstats.Cash
local StoneValue = player.leaderstats.Stone
local cashLabel = player.PlayerGui.Stats.CashLabel
local stoneLabel = player.PlayerGui.Stats.StoneLabel
CashValue.Changed:Connect(function()
cashLabel.Text = "Cash:"..CashValue.Value
end)
StoneValue.Changed:Connect(function()
stoneLabel.Text = "Stone:"..StoneValue.Value
end)
It doesn’t work.Gives me no error. And if it’s changed instead of the event loop then it won’t show you the cash when you joins and it hasn’t changed yet?
Edit: Oh wait I forgot to replace the playergui thing