Index Nil with "leaderstats" issue

I was just making a simple click button script. The player has a folder called leaderstats inside it but this is the error.


The script:

In game:
image
All help is appreciated. Thanks!

1 Like

Try using a :WaitForChild() for ‘leaderstats’.

-- e.g.

local atoms = player:WaitForChild("leaderstats"):FindFirstChild("Atoms").Value
1 Like

Oh sorry. My mistake. The script was a server script not a local script. lol

1 Like

Thanks anyways though. charscharschars

You do realise mousbutton1click doesnt work on the server right?

Yes, I realised that. charcyter limit os lame