Datastores not working due to GetAsync issue

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)
2 Likes

Did you mean GetAsync for the DataStore?

Yes, I believe so.
This would be to utilize the datastore with the async.

1 Like

You misspelled Async on line 12.
ds:GetAsync(plrkey, NumberForSaving)