Making a simple datastore but I am running into a simple problem that I cannot figure out right away,
local DataStoreService = game:GetService ("DataStoreService")
local playerdata = DataStoreService:GetDataStore ('PlayerData')
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local save1 = plr.leaderstats["Points Per Second"]
local save2 = plr.leaderstats.Points
local save3 = plr.valueStore["Points Per Second"]
local save4 = plr.valueStore.Points
local GetSaved = playerdata:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
save3.Value = GetSaved[3]
save4.Value = GetSaved[4]
else
local NumberForSaving = {save1.Value, save2.Value, save3.Value, save4.Value}
playerdata:GetAsync(plrkey, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
playerdata:SetAsync("id_"..plr.userId, {plr.leaderstats.Points, plr.leaderstats["Points Per Second"], plr.valueStore.Points, plr.valueStore["Points Per Second"]})
end)
It is giving me a error saying I cannot store Arrays which confuses me because the error is coming from the PlayerRemoving function, this seems simple but I am tired of staring at my screen intensely.

1 comment
Fixed it after stareing again, The PlayersRemoving function did not have the value labeled on them.