Is there any way to still show a gui when BindToClose?

Hello!
So, I’m wondering if there is option to show a gui when game:BindToClose?
Basically, I want to create shutdown system which teleports players to another place, and that gui would be displayed. But I don’t know how to do that on game bind to close.
It just disappears if I do it.

Thank you.

1 Like

Hi so from the looks of it your trying to make your own version of a Soft Shutdown, Merely has an open sourced version and I think it is basically what you are looking for and you edit it to fit your needs!

This is sadly not working for me. It just shuts down the server. Is there any way to fix it?

Oh, I did see that before, but read it doesn’t work anymore. Just tested it, can confirm it’s working.

1 Like

I’ve made an alternative with a command that teleports players to another place and then back with messaging service.

EDIT: Actually, even the soft shutodown should work, the wiki says “The game will wait a maximum of 30 seconds for all bound functions to complete running before shutting down. After 30 seconds, the game will shut down regardless if all bound functions have completed or not.”
I’ll do a bit further testing brb.

EDIT2: Seems to be working fine.

I pasted the raw source from the github and it worked just fine for me without having to edit any of the code.

3 Likes

It’s not working for me :confused:
It just shuts down the server a few seconds later…

did you copy-paste the script into a script in serverscriptservice (workspace is fine but serverscriptservice is where all game scripts should be)?

1 Like

Well, if It helps you, I have DataStore2, which also has its own BindToClose event …

My game also has another bindtoclose on my datastore script, still worked for me

This is what I always get

I don’t know what else to tell you, maybe datastore2 has a force shutdown? Try it in a place without datastore2.

Sorry about necroposting, but I found the problem. Apparently, when DataStore2 does BindToClose it parents the player to nil, thus causing the player removing event to be triggered, which then prevents the soft shutdown script to not teleport the players. @Kampfkarren any solution to this?

Again sorry for the necropost, but I found a solution to this.

Search all scripts for “.parent = nil” go to the one from the Datastore2 script and comment/remove it. Then set up your own .BindToClose function in your saving script, and save everything. Then you can also have UI show up.

The only problem with that is the fact that you’re also going to have some data loss issues, when I tested that there were data loss issues for me.

1 Like