I want to save peoples data so that when the player joins the game again they still have their stats.
function onPlayerEntered(newPlayer)
local NeededXP = 25
local AddXP = 5
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local score = Instance.new("IntValue")
score.Name = "Money"
score.Value = 0
score.Parent = stats
stats.Parent = newPlayer
local level = Instance.new("IntValue")
level.Name = "Level"
level.Value = 1
level.Parent = stats
stats.Parent = newPlayer
local XP = Instance.new("IntValue")
XP.Name = "XP"
XP.Value = 0
XP.Parent = stats
stats.Parent = newPlayer
while true do
wait(0)
if XP.Value >= NeededXP then
XP.Value = XP.Value - NeededXP
NeededXP = NeededXP + AddXP
level.Value = level.Value + 1
end
end
end
game.Players.ChildAdded:connect(onPlayerEntered)

2 comments
Use a data store. There are multiple guides here to help you get one made.
not sure m8