Hello, I am changing the value of a text label with code so that it equals the number of coins that the player has, but the text label UI is not updating, even though I can print the .text of it and it displays its value.
local Players = game:GetService("Players")
function onPlayerAdded(player)
local Money = Instance.new("IntValue")
Money.Name = "Coins"
Money.Value = 166
game.StarterGui.ScreenGui.CoinAmount.Text = Money.Value
print(game.StarterGui.ScreenGui.CoinAmount.Text)
end
--When a player joins, call the onPlayerAdded function
Players.PlayerAdded:connect(onPlayerAdded)
--Call onPlayerAdded for each player already in the game
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end

4 comments
You are changing and printing the value in the StarterGui, not the player's specific PlayerGui.
I don't see anything called "PlayerGui".
What I do see is StarterGui, StarterPack, and StarterPlayer, but I don't see the PlayerGui.
PlayerGui is located in game.Players.(Player).PlayerGui.