So I was fixing code for a game and I was getting Not running script because past shutdown deadline
error.
function PlayerDataHandler:Start()
if not game:GetService("RunService"):IsStudio() then
game:BindToClose(function()
for _, player in ipairs(players:GetPlayers()) do
coroutine.wrap(function()
self:Save(player)
end)()
end
end)
end
end
Is the thing erroring I believe. Anyone know how to fix it?
1 Like
The description you’ve given of the issue is a bit vague. Looking at the code though, I’d bet that because you’ve used a coroutine here that’s the issue. The goal of the BindToClose function is to block the game from closing until a certain thing is done, coroutines by design are non-blocking and thus won’t do what you want here. I would try removing that and see if that helps.
function PlayerDataHandler:Start()
if not game:GetService("RunService"):IsStudio() then
game:BindToClose(function()
for _, player in ipairs(players:GetPlayers()) do
self:Save(player)
end
end)
end
end
1 Like