I have a LocalScript inside a GUI. I am trying to change the text of a TextLabel. I want the text to say: $0 / $4000. It only says 0. (That's the text it is before playing.)
This is the LocalScript:
local player = game.Players.LocalPlayer local cashCollected = player:WaitForChild("CashCollected") local storage = player:WaitForChild("Storage") script.Parent.RewardText.Text = "$"..cashCollected.Value.."/"..storage.Value cashCollected:GetPropertyChangedSignal("Value"):Connect(function() script.Parent.RewardText.Text = "$"..cashCollected.Value.." / $"..storage.Value end)
Any help?
From a LocalScript
, you can access the LocalPlayer
's PlayerGui
and make edits from there:
local player = game.Players.LocalPlayer local cashCollected = player:WaitForChild("CashCollected") local storage = player:WaitForChild("Storage") player.PlayerGui.ScreenGui.RewardText.Text = "$"..cashCollected.Value.."/"..storage.Value -- Fix #1 cashCollected:GetPropertyChangedSignal("Value"):Connect(function() player.PlayerGui.ScreenGui.RewardText.Text = "$"..cashCollected.Value.." / $"..storage.Value -- Fix #2 end)