I’m trying to get “leaderstats” so I can add/remove a currency from a users stats and make it permanent, when I attempt to use commands to do this it says “user does not have a leader stats folder”
my issue is I have no idea how to make leaderstats and I need help making them
Ok, create a script inside of the ServerScriptService and use an example code like this:
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local l = Instance.new("Folder", player)
l.Name = "leaderstats"
local m = Instance.new("NumberValue", l)
m.Name = "Money"
m.Value = 250
end)
Anything inside of a folder named leaderstats will be put as a leaderstat. However, to ever alter these values, you will need to run that through a serverScript.
To save time instead of putting l.Parent = player, if you put a comma after the instance you make, the thing you put there will be the parent.
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
---You can add more stats in the leaderstats script