What I assume you want is to tie a value to a player.
You should use ValueBases for this, namely IntValue or NumberValue, you should then parent it to the player so that you can automatically tie it to the player
If you name a Folder or Model ‘leaderstats’ then parent it to a player, it will appear in the leaderboard
local Players = game:GetService("Players")
local function PlayerAdded(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local money = Instance.new("NumberValue")
money.Name = "Money"
money.Value = 0
money.Parent = leaderstats
leaderstats.Parent = plr
end)
Players.PlayerAdded:Connect(PlayerAdded)
Since this is binding an event, you’d preferably want this in a regular old script.
But now, (as long as you do it on the server), you have created a Money value that can be easily changed by doing
Players.(player name).leaderstats.Money.Value = (value)
TLDR @scripting1st: PSA: Don't use Instance.new() with parent argument