My datastore doesn't work. I have done everything right. This is the script
```lua 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) ```
Make the part where you get points Filtering Enabled.
What this means?
Well, FE is pretty simple once you get the hang of it. I will take you though the proper steps. So, the part you want to be FE is the time you get points. You need a RemoteEvent, a controlling script and the datastore script.
First, add a RemoteEvent into Replicated Storage. After this, rename it to whatever you want. I will name it Tutorial for now. Now add a script into ServerScriptService, and insert the following code.
game.ReplicatedStorage.Tutorial.OnServerEvent:Connect(function() --Enter code to give money/cash/rebirth here! end)
In between the function and the End, add the code that adds the currency. Now delete the part where it adds the currency in your original script that adds the currency, and change that code too:
game.ReplicatedStorage.Tutorial:FireServer()
--Spiral. Tell me if something doesn't work, or you don't understand!