So here is my server script in Workspace:
local ds = game:GetService("DataStoreService")
local ss = ds:GetDataStore("StageStore")
local fs = ds:GetDataStore("FinishStore")
local function load(plr)
for i = 1,3,1 do
local success, err = pcall(function()
local stats = Instance.new("Folder",plr)
stats.Name = "leaderstats"
local stage = Instance.new("NumberValue",stats)
stage.Name = "Stage"
stage.Value = ss:GetAsync(plr.UserId,stage.Value) or 1
local f = Instance.new("NumberValue",stats)
f.Name = "Finishes"
f.Value = fs:GetAsync(plr.UserId,f.Value) or 0
end)
if success then
break
elseif err then
warn(err)
end
end
end
local function save(plr)
for i = 1,3,1 do
local success, err = pcall(function()
ss:SetAsync(plr.UserId,plr.leaderstats.Stage.Value)
fs:SetAsync(plr.UserId,plr.leaderstats.Finishes.Value)
end)
if success then
break
elseif err then
warn(err)
end
end
end
game.Players.PlayerAdded:Connect(function(plr)
load(plr)
end)
game.Players.PlayerRemoving:Connect(function(plr)
save(plr)
end)
game:BindToClose(function()
for _, plr in ipairs(game.Players:GetPlayers()) do
coroutine.wrap(save)(plr)
end
end)
This is the warning I get:
API Services rejected request with error. HTTP 500 (Internal Server Error)
This only started happening about an hour or two ago. Before then, the script worked. Is there a problem with my script or is it a Roblox error?

2 comments
Did you enable API Services?
Yes.