Im trying to make the number also show in GUI text this is the script I tried but didn't work.
while true do game.StarterGui.ScreenGui.Money.TextLabel.Text = game.Players.LocalPlayer.leaderstats.Money.Value wait() end
Some beginners may find this to be a quick way to change a Gui for all players. Unfortunately, it's not that simple. StarterGui is basically what PlayerGui clones from when you respawn. That means, any changes you make to objects in StarterGui will not show until you respawn.
Taken from the Common Mistakes blog post.
With that in mind, you will be changing the Text
from the PlayerGui
. You also should not be using a while
loop to do something a Changed
event should be doing.
local client = game:GetService("Players").LocalPlayer local player_gui = client:WaitForChild("PlayerGui") local leaderstats = client:WaitForChild("leaderstats") leaderstats.Money.Changed:Connect(function(new_value) player_gui.ScreenGui.Money.TextLabel.Text = tostring(new_value) end)