"Not running script because past shutdown deadline"

So i have been working recently on my game and ive noticed everytime i stop the game on studio it freezes my studio for a couple seconds and says on output “Not running script because past shutdown deadline” . if you know a solution to this please tell me.

5 Likes

I am having the same problem than you. I heard it’s a bug in studio (even if you wait 1 second in BindToClose or do anything that yields for example saving player data) it will freeze for 30 seconds. Check out the bug here BindToClose 100% Infinite Yield

4 Likes

Did this start recently? Are you using DataStore2?

1 Like

I am using DataStore2 and I’m having the exact same issue as him. So I’m assuming he is.

3 Likes

This is happening to me as well, but I am using data store.

I got around this by checking if it’s currently not in studio mode:

local rs = game:GetService("RunService")

game:BindToClose(function()
    if not rs:IsStudio() then
        --boop
    end
end)
1 Like

Yeah, as @SiberianCatKitten said, this is a Roblox Studio bug and has nothing to do with DataStore2 or your own code, unless you’re actually taking longer than thirty seconds. You’ll have to avoid yielding from BindToClose callbacks in Studio (game:GetService("RunService"):IsStudio()) to prevent this, or wait out the thirty seconds.

@LandofLee1620 @Kotojo

1 Like

How did you get around it by using that function? Where in the code do you place it, because it’s not working for me haha

1 Like

Yeah I noticed this recently and I’m not using Datastore2 just regular SetAsync

I just checked in my BindToClose function if it’s Studio or not, infact you could have this at the top of the function:

if game:GetService("RunService"):IsStudio() then return end

Can anyone else confirm that they’re still getting this problem? As of today I’m still having this issue with Kohls admin. I will use the work-around for now.

1 Like

This is how I handle my BindToClose and it works fine in studio and live.

[code]

– BindToClose in case game fails or disconnects for some reason
game:BindToClose(function()

-- print("game:BindToClose has been fired")

		spawn(function()
			
				local success, errorMessage = pcall(function()
							-- your code goes here
						
				end);
				if not success then
					print("[SERVER BindToClose] Error "..errorMessage);
				end		
			
			
		end)

end)
[/code]