Server Close Event

Hi everyone, I was wondering if there was an event that would be fired just before the server closes

There is. It is called game:BindToClose.

Example:

game:BindToClose(function()
	for i,v in pairs(game.Players:GetPlayers()) do
		-- Save data or something.
	end
end)
1 Like

It’s a callback, not an event.

game.BindToClose = function()
    -- do stuff
end

That will not work, it will say that it is not a valid member of it.
I am sorry for the confusion, but the API documentation describes it as a method.

Please review this if you want an example from the API documentation.

Ah thanks, I was thinking of the older OnClose callback. BindToClose is new.

Just wondering, will players still be able to join while that’s being executed?

It happens when the Server Closes, no new players will be able to join that server anymore since it closed

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.