Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Datastore/Data Persistance not working for value given to "newPlayer"?

Asked by 7 years ago
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

0
This is data persistance not a data store. User#5423 17 — 7y
0
Never use Data Persistance. Use Data Stores. alphawolvess 1784 — 7y

Answer this question