How do I access someone's leaderstats' values?

I feel like this is quite obvious but I’m not 100% sure.

I want to access a player’s points in order to increase/decrease them but I don’t know how to do it

local Players = game:GetService("Players")
local Player = Players.Player -- Replace "Player" with the target player's username

local leaderstats = Player:WaitForChild("leaderstats")
leaderstats.Points.Value = 10

Also this will only work in server-side for data storing and such.

1 Like

Yes. To read the value of points, you need to do:

local Points = leaderstats.Points.Value

To increment or decrease the value, do:

leaderstats.Points.Value += 10 -- Adds 10 points
leaderstats.Points.Value -= 5 -- Takes away 5 points

Thanks for all helping guys but I figured it out myself before reading all the replies by using the GetPlayerFromCharacter() function