I am using a data saving script and for the most part it works. What I am trying to do is save a players rebirths and strength. But when I rejoin the rebirth value is the same as the strength value (ex I have 50 strength 2 rebirths when I rejoin I have 50 strength 50 rebirths). Please help, here is the (server)script. Also btw this code is part of one big script that happens when the player joins the game.
local strengthData, rebirthsData
local success,errormessage = pcall(function()
strengthData = DataStore:GetAsync("strength-"..player.UserId)
rebirthsData = DataStore:GetAsync("rebirths-"..player.UserId)
end)
if success then
if strengthData then
strength.Value = strengthData
end
if rebirthsData then
rebirths.Value = rebirthsData
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
DataStore:SetAsync("strength-"..player.UserId,player.leaderstats.Strength.Value)
DataStore:SetAsync("rebirths-"..player.UserId,player.leaderstats.Strength.Value)
end)
end)

13 comments
this is the exact thing that I already have...
No it isn't.
The first script is what you have, the second one isn't.
You set the rebirths data as the strength. If you skim over it you can see you did Strength.Value for both DataStores
i copied it in and nothing changed
Did you add to your rebirths? Because if you didn't that's why it stayed at 50 since you saved it as 50 which was your strength last time.
no it didn't help it's still doing it
i tested it added to my strength rejoined rebirths are the same amount
Add to your rebirths.
okay..
Nope still not working
Is there any error?
nope