i was testing a script on a team play. the script is for saving a table for a obby stage. but wen i test it i get a error code that does not make sense. can any one help pleas?
the error code is : 21:07:42.839 - 502: API Services rejected request with error. HTTP 403 (Forbidden)
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("MyDataStore")
game.Players.PlayerAdded:Connect(function(player)
local ack = Instance.new("Folder")
ack.Name = "leaderstats"
ack.Parent = player
local ack2 = Instance.new("IntValue")
ack2.Name = "Stage"
ack2.Parent = ack
local data
local success, errormassage = pcall(function()
data = DataStore:GetAsync(player.UserId.."-stage")
end)
if success then
ack2 = data
else
print("there was an error whilst getting your data")
warn(errormassage) end
local test = player.leaderstats.Stage.Value
end)
function oa(object)
wait()
local player = game.Players:playerFromCharacter(object)
if player ~= nil then
local ls = player.leaderstats
local sl = game.Workspace:FindFirstChild(ls.Stage.Value)
print("gah")
object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0)
if sl ~= nil then
object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0)
end
end
end
game.Workspace.ChildAdded:connect(oa)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
DataStore:SetAsync(player.UserId.."-stage",player.leaderstats.Stage.Value)
end)
if success then
print("Player Data successfully saved!")
else
print("there was an error when saving data")
warn(errormessage)
end
end)

3 comments
thx for the help but im doing this on a friends game and he says its enabled but for me it shows that its not enabled but it wont let me change it?
Try asking your friend about it, maybe he/she knows what is going on. (Or at least has a clue of why that is happening)
Also, try reading this: https://developer.roblox.com/en-us/articles/Datastore-Errors