Updating the Leaderstats (Real-Time preferably)

I’m making a game about clicking stuff. This sample of a script is meant to update the gold variable when the player clicks, meaning the leaderstats should be updated as well.
image
The former function is done perfectly but the latter function is not working for whatever reason. I’ve tried a couple of methods but neither seem to work.

Could anyone figure out a solution to this issue I’m having? If you’re wondering, the Leaderboard script is stored in ServerScriptStorage, if that helps.

Are you using the Roblox leaderstats or creating your own?

If your using the roblox leaderstats (show in player list) then you can access it like so:

plr.leaderstats.gold.Value += reward

Starterpack items are inserted into the player’s character. This is typically where you store tools, not variables.

2 Likes