I have been trying to save values with an array but values get switched or they just don't save.
This is when the player joins the game.
-- Loading Data
local success, result = pcall(function()
Storage:GetAsync(player.UserId)
end)
if not success then
warn(result)
else
local LoadArray = Storage:GetAsync(player.UserId)
if LoadArray then
level.Value = LoadArray[1]
credits.Value = LoadArray[2]
xpn.Value = LoadArray[3]
xp.Value = LoadArray[4]
end
end
This is when the player leaves.
local SaveArray = {player.leaderstats.Level.Value, player.Credits.Value, player.XP.Value, player.XPN.Value}
Storage:SetAsync(player.UserId, SaveArray)

3 comments
it has to be in order
so change the save array to player.XPN.Value, player.XPN.Value in the table
Thank you