Hey, I’ve been recently trying to set up a datastore for my game (to save cash on rejoin,) and I have run into this error.
I have absolutely no clue how to fix this ( I never script.) I’ve tried looking over the script to see why “getasync” is not a valid member of the datastore server, yet I can’t seem to figure out why.
Here’s the script in question.
local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local save1 = plr.leaderstats.Cash
local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
else
local NumberForSaving = {save1.Value}
ds:GetAysnc(plrkey, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync("id_".. plr.userid, {plr.leaderstats.Cash.Value})
end)