Hello, I made a money Gui (with tutorial) and it work when I test it on studio (see the screenshot). But after publishing in the real game, the money Gui don’t work anymore (see the second screenshot). Someone can help me to fix it please ?
Screenshot of studio in test :
@FerbZides’s solution will work, but the appropriate and efficient way to do this is to utilize the Changed event to avoid constantly looping unnecessarily.
it is still unnecessary, the .Changed event only fires when the value changes anyways.
@lllloooolllllm Here is a better alternative, efficient compared to using a while wait() loop
local players = game:GetService("Players")
local player = players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local cash = leaderstats:FindFirstChild("Cash")
cash.Changed:Connect(function(newVal)
script.Parent.Text = "Cash: ".. newVal
end)
Also try using :GetService() instead of using dot syntax for services.
edit: @FerbZides Then you probably did it wrong, try this