i noticed that its been more than a week, and you have neither marked this topic as “solved”, or responded to me for more help.
because of this, ive noticed that you are having trouble with the for loops and the creation of values.
the reason i did
for i, Value in pairs(player.playerstats:GetChildren()) do
local Thing = {
["Name"] = Value.Name,
["Value"] = Value.Value
}
table.insert(data, Thing)
end
instead of something like
local data = {
player.playerstats.Coins.Value,
player.playerstats.DataId.Value
}
was so it would be easier to create a third or fourth value, and so on…
if you wanted to add a value, lets say its called “StageCount”, all i would hae to do to add a value was add a
local Stage = Instance.new("IntValue")
Stage.Name = "StageCount"
Stage.Value = 0
Stage.Parent = playerstats
in the place where the new data is created for new players
this would add a value, then save name and value, then, upon rejoining, player would get a value created based on name and value.
if you save the data like this:
local data = {
player.playerstats.Coins.Value,
player.playerstats.DataId.Value
}
then you could load in the data like this:
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Value = data[1]
coins.Parent = playerstats
local dataId = Instance.new("IntValue")
dataId.Name = "DataId"
dataId.Value = data[2]
dataId.Parent = playerstats
instead of the method that i demonstrated
hope i helped! (if you did, would appreciate if you mark a post as the solution, would help a lot of people using this as reference)