When ever I try to save using datastores I get this error:
502: API Services rejected request with error. HTTP 403 (Forbidden) Stack Begin Script 'ServerScriptService.PlayerStast', Line 20 Stack End
this is my code:
local DSS = game:GetService("DataStoreService")
--Data stores
local ds = DSS:GetDataStore("Cash") ---Cash
game.Players.PlayerAdded:Connect(function(player)
--PlayerStats
local stats = Instance.new("Folder")
stats.Name = "PlayerStats"
stats.Parent = player
--Cash
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Parent = stats
cash.Value = ds:GetAsync(player.UserId.."-cash") or 100
cash.Changed:Connect(function()
ds:SetAsync(player.UserId.."-cash",player.PlayerStats.Cash.Value)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
ds:SetAsync(player.UserId.."-cash",player.PlayerStats.Cash.Value)
end)

3 comments
I awnsered your question
no you havent it is still not working. Also it works fine on my brothers account
i have created a new game and it works