Not a valid member but it is

I’m not at all a scripter so please don’t judge me if the mistake I made is silly :D.

Scripts:

Context:

I’m trying to make the players money pop into a GUI
image

But the script keep saying that “leaderstats is not a valid member”
image

I’ve tried to use Waitforchild

But it’s saying that there is an infinite yield possible meaning that they are looking for something that doesn’t exist yet?
image

But I check when I run the game, the leaderstats are there
image

Read this Roblox doc on the built in leaderboards and it will explain leaderstats:

  1. leaderstats is supposed to be a folder.
  2. use Player:FindFirstChild("leaderstats"), as leaderstats is not a child of the player service and should never be
  3. Use a .Changed event instead of a loop to minimize on memory usage