Leaderstats (Coins & Level)
DataStarterThe classic starter system. Gives every player Coins and a Level, shown on the player list. Other scripts can read and update these values through this function.
-- leaderstats for every player who joins
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Value = 0
coins.Parent = leaderstats
local level = Instance.new("IntValue")
level.Name = "Level"
level.Value = 1
level.Parent = leaderstats
end
Players.PlayerAdded:Connect(onPlayerAdded)