The datastore isn't working it's giving me an error: GetASync is not a valid member of GlobalDataStore "DataStoreService.NadaSplitBaseball"
here is the code:
local DataStore = game:GetService("DataStoreService")
local myDataStore = DataStore:GetDataStore("NadaSplitBaseball")
game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = plr
local Strength = Instance.new("NumberValue")
Strength.Name = "Strength"
Strength.Parent = leaderstats
Strength.Value = 0
local data
local success, errormessage = pcall(function()
data = myDataStore:GetASync(plr.UserId.."-Strength")
end)
if success then
Strength.Value = data
else
print("There was an error while giving Player Data.")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, errormessage = pcall(function()
myDataStore:SetASync(plr.UserId.."-Strength", plr.leaderstats.Strength.Value)
end)
if success then
print("Player Data successfully saved!")
else
print("There was an error while saving Player Data.")
warn(errormessage)
end
end) end)
