function api.check(player) local Player_Key = (DataStoreKey.."_"..player.userId) local Player_Data = Datastore:GetAsync(Player_Key) if Player_Data then return true else return false end end
Error: GetAsync is not a valid member of DatastoreService
This is because you are trying to use :GetAsync()
on DataStoreService. The method does not exist for that. However, if you did :GetAsync()
on a datastore, it would.
Here is what I mean:
local dss= game:GetService("DataStoreService") -- Get the service local datastore = dss:GetDataStore("TestDataStore") -- Get the datastore dss:GetAsync(key) -- Won't work because GetAsync() is not a method of DataStoreService. datastore:GetAsync(key) -- Will work because GetAsync() is a method of DataStore
Here is a link if you want to learn more about saving data.