Play server closes before yielded functions complete

In all of my games, I save the player data, and it never fully saves when in play mode.

Code to replicate it:

game.Players.PlayerRemoving:Connect(function()
	warn("Waiting")
	wait(1)
	warn("Waited 1 second")
end)

It warns it is waiting, but Waited 1 second never prints.
It works fine in the local server test, and fine in live servers.
I am on the latest version of roblox studio, on windows 10. I only just noticed that stats weren’t saving around a week ago, not sure when this really started.

1 Like

Same issue occurs with BindToClose.

Server closes before all yielded functions complete, which is quite frustrating in my end.