game.Players.PlayerRemoving:connect(function(p)
if p:findFirstChild("Rebirths") then
p:SaveInstance("RebirthValue"..tostring(game.PlaceId),p.Rebirths)
end
end)
game.Players.PlayerAdded:connect(function(p)
for k = 1, 60, 0.03 do
wait()
if p:findFirstChild("Rebirths") and p.DataReady then break end
end
local Loaded = nil
if p:findFirstChild("Rebirths") and pcall(function() Loaded = p:LoadInstance("RebirthValue"..tostring(game.PlaceId)) end) then
pcall(function() p.Rebirths.Value = Loaded.Rebirths.Value end)
end
end)
So I am trying to use this script to save/load the value of "Rebirths" someone has when they leave and join. The Rebirths value is set in newPlayer as an IntValue. I am able to save the leaderstats perfectly fine, but how would I save the values not in leaderstats such as newPlayer?
Thanks, MCPE11

2 comments
This is data persistance not a data store.
Never use Data Persistance. Use Data Stores.