So, I'm trying to make a DataStore for cash in a game. For some reason, even after enabling API Services in the Studio settings, I still get the error message:
"502: API Services rejected request with error. HTTP 403 (Forbidden)"
(Proof of enabling API Services: https://prnt.sc/t1l1p7)
Here is my code:
local DataStoreService = game:GetService("DataStoreService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local cashDataStore = DataStoreService:GetDataStore("cashDataStore") game.Players.PlayerAdded:Connect(function(player) cashCounter = player.PlayerGui:WaitForChild("StarterScreenUI").sideGui.Frame.cash local cashData local success, errormessage = pcall(function() cashData = cashDataStore:GetAsync(player.UserId.."-cash") end) if success then cashCounter.Text = "$"..cashData else cashDataStore:SetAsync(player.UserId.."-cash",200) cashData = cashDataStore:GetAsync(player.UserId.."-cash") cashCounter.Text = "$"..cashData end return cashCounter end) game.Players.PlayerRemoving:Connect(function(player) local success, errormessage = pcall(function() cashDataStore:SetAsync(player.UserId.."-cash",cashCounter.Text) end) if success then print("Success") else warn(errormessage) end end) ReplicatedStorage.Events.PurchaseSaveEvent.OnServerEvent:Connect(function() end) while wait(2) do cashData = cashData + 1 cashCounter.Text = "$"..cashData print(cashCounter.Text) end