I have been thinking how to access leaderstats of a player from another codeblock but in the same script. I tried many ways and eventually got nothing. I really do need help with this as I am not a very professional scripter.
COMMUNITY QUESTION
How to access leaderstats from outer the player joined codeblock?
1 answer
Game.Players[playername].leaderstats
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
game should be with a lowercase sorry
I think you can edit your answer.
I keep getting an error with bad argument #2 (string expected, got nil). Can you please explain how this works?
Make sure it's the playername your putting in the square brackets. If you have the path to a player like player = game.Players.LocalPlayer or something similar then just use player.leaderstats
I get this error: attempt to index nil with 'leaderstats'.
Have you created a leaderstats folder inside of the player when they join?