0

# Datastore attempts to index number with number and fails?

So when the datastore script tries to get the Cubes value from the Datastore, it gives me an error saying "ServerScriptService.Datastore:9: Attempted to index number with number" which I have no idea on how to fix.

Datastore script:

local datastore = game:GetService("DataStoreService"):GetDataStore("SaveData")
wait()
local plrid = "id_"..plr.UserId

local GetSaved = datastore:GetAsync(plrid)
if GetSaved then
save1.Value = GetSaved[0]
else
local NumSave = {save1.Value}
datastore:GetAsync(plrid,NumSave)
end
end)

game.Players.PlayerRemoving:Connect(function(plr)
end)


local Players = game:GetService("Players")

end



0
Edited 21 days ago

GetSaved[1] and local GetSaved = datastore:GetAsync("id_"..plrid)

0
it works now, but it won't save. Every time I rejoin the cubes get set back to 0. MrBucketOfficial 39 — 21d
0