My DataStore script isn't working it keep getting an error saying that GetAsync() is not a valid member of datastore?
local datastore = game:GetService("DataStoreService")
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("IntValue")
leaderstats.Name = "Stat"
leaderstats.Parent = player
local stata = Instance.new("BoolValue")
stata.Name = "NewPlayer"
stata.Parent = leaderstats
local key = "user-" .. player.userId
local storeditems = datastore:GetAsync(key)
if storeditems then
stata.Value = storeditems[1]
else
local items = {stata.Value}
datastore:SetAsync(key, items)
end
end)
game.Players.PlayerRemoving:connect(function(player)
local items = {player.Leaderstats.Stat.Value}
local key = "user-" .. player.userId
datastore:SetAsync(key, items)
end)

2 comments
Oh! Thank you again for your help and I will be sure to ask you on Roblox for help!
Okay.