game.Players.PlayerAdded:connect(function(player)
local stats = Instance.new("IntValue", player)
stats.Name = "leaderstats"
local level = Instance.new("IntValue", stats)
level.Name = "Level"
level.Value = 1
local new = Instance.new("IntValue", player)
new.Name = "New"
new.Value = 0
local complete = Instance.new("IntValue", player)
complete.Name = "Complete"
complete.Value = 0
if not stats then
return
end
if not complete then
return
end
player:SaveNumber("Complete", complete.Value)
end)
game.Players.PlayerRemoving:connect(function(player)
player:WaitForDataReady()
local stats = player:FindFirstChild("leaderstats")
if not stats then
return
end
local complete = player:FindFirstChild("Complete")
if not complete then
return
end
player:SaveNumber("Complete", complete.Value)
end)
I want it to save the players Complete stats when they leave and laod when they join. I enabled all the data store stuff to studio, but it keeps saying Data is not ready for DataStore, or something along those lines. Please help.
