I have a save stats script, but it does not work right! It saves my point but does not save my rebirth, why? For example, if I have 100 points, and I rebirth, and I left the game, and later if I join back it will say I have 100 points and 0 rebirths, why? Another problem is that, whenever I rebirth and it will clear my points and give me 1 rebirth, but when I click on a block that gives me points, it automatically start me with 100 points, why? For example, if I rebirth I will have 1 rebirth and it will clear my points, but when I click on a block that gives me 2 points, I will automatically have 102 points, why?
Here is the save stats script
function onPlayerEntered(player)
wait()
player:WaitForDataReady()
repeat wait() until player:FindFirstChild("leaderstats")
if player.DataReady then
if player:findFirstChild("leaderstats") then
local score = player.leaderstats:GetChildren()
for i = 1,#score do
local ScoreLoaded = player:LoadNumber(score[i].Name)
wait()
if ScoreLoaded ~= 0 then
score[i].Value = ScoreLoaded
end
end
end
end
end
function onPlayerLeaving(player)
if player:findFirstChild("leaderstats") then
local score = player.leaderstats:GetChildren()
for i = 1,#score do
player:SaveNumber(score[i].Name,score[i].Value)
end
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)
game.Players.PlayerRemoving:connect(onPlayerLeaving)
Here is the leaderstats script
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "LifeFormFound"
money.Value = 0
money.Parent = leaderstats
local Points = Instance.new("IntValue")
Points.Name = "Rebirth"
Points.Value = 0
Points.Parent = leaderstats
end)

3 comments
You're obviously not handling the rebirth system right... which is why you should post that as well. Try figuring out if all of the values are being loaded so that you can check if that's what's being loaded in. Do this by using prints. PRINTS ARE SO USEFUL IN DEBUGGING. srsly, utilize them.
Yeah what the guy above said. Also why is there no indenting on your first script?
SaveNumber and WaitForData ready are deprecated, so is findFirstChild and :connect