My datastore doesn't work. I have done everything right. This is the script
local Datastore = game:GetService("DataStoreService"):GetDataStore("pixel-DS3")
game.Players.PlayerAdded:Connect(function(player)
local Key = "Player-ID:" .. player.userId
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local Coins = Instance.new("NumberValue", leaderstats)
Coins.Name = "Coins"
Coins.Value = 0
local Strength = Instance.new("NumberValue", leaderstats)
Strength.Name = "Strength"
Strength.Value = 0
local Rebirths = Instance.new("NumberValue", leaderstats)
Rebirths.Name = "Rebirths"
Rebirths.Value = 1
-- GetAsync
local GetSave = Datastore:GetAsync(Key)
if GetSave then
Coins.Value = GetSave[1]
Strength.Value = GetSave[2]
Rebirths.Value = GetSave[3]
print("Data loaded for " .. player.Name)
else
local Numbers = {Coins.Value, Strength.Value, Rebirths.Value}
Datastore:SetAsync(Key, Numbers)
print("Data Saved for " .. player.Name)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local Key = "Player-ID:" .. player.userId
local ValuesToSave = {player.leaderstats.Coins.Value, player.leaderstats.Strength.Value, player.leaderstats.Rebirths.Value}
Datastore:SetAsync(Key, ValuesToSave)
print("Data Saved for " .. player.Name)
end)

3 comments
If it was "right" it would work. Also Lua is not an acronym so it shouldn't be all in caps...
You should use pcall() since DataStore fails sometimes.
the site is having issues so its ----probably---- not gonna work, idk i dont work with datastore anyways