game.Players.Playeradded works the first time but never runs after

I am using PlayerAdded to show the amount of money you have, however if you die and respawn the amount does not load unless you withdraw or deposit money.

because a player isn’t added, the player stays there until the user leaves the game, it is forever in Players

PlayerAdded works whenever player joins the game.
You can use CharacterAdded whenever the player character added (When player dies the character respawns and triggers the characterAdded function)

game.Players.PlayerAdded:Connect(function(plr)
   plr.CharacterAdded:Connect(function(char)
        -- Code here
   end)
end)

You can use plr.CharacterAdded:Wait() too.

1 Like

When the user joins, a Player is added to game.Players.
The instance will stay there until the user leaves the game.

I’ve just tried it and, it still just makes the UI say $0.

Mention the codeβ€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž

Show the UI script so we can understand the problem

Disable .ResetOnSpawn for the Gui

and use .CharacterAdded not Playeradded

local value = -- path to value.
value:GetPropertyChangeSignal("Value"):Connect(function)
 -- set the value.
end)