local Players = game:GetService(“Players”)
local PointsService = game:GetService(“PointsService”)
function onPlayerAdded(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = playerlocal points = Instance.new("IntValue") points.Name = "Points" points.Value = 0 points.Parent = leaderstats
end
function onPlayerRemoving(player)
PointsService:SetPoints(player.UserId, player.leaderstats.Points.Value)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(onPlayerRemoving)