Destroyed BindToClose script breaks Stop button

If a script using game:BindToClose() is destroyed, then the Stop button in Studio breaks. This forces the user to have to exit out of Studio without stopping the game.

Easy to replicate:

  1. With any place in Studio, create a new Script and put in any BindToClose code such as below:
      game:BindToClose(function() --[[ Anything or nothing here ]] end)
  1. Run the game
  2. Delete the script
  3. Press the Stop button in Studio
  4. Notice error:
    stop_bug

The “Show Details…” button literally just shows the contents of the Output window. Nothing useful there.

11 Likes

Can confirm this is also happening to me. After pressing OK, studio freezes and you can’t do anything else without restarting studio.

2 Likes

Yep. Studio just froze after clicking “Ok” and nothing happens. Had to use the task manager to close it.

1 Like

My question is what reason would you have to destroy a script with bind to close in it?

No reason, but this still isn’t intentional which is what makes it a bug.

1 Like

Possible scenario: You have a vehicle script that uses BindToClose to save data when the server closes, but you accidentally drive it off the map in Studio…now you’re unable to stop Studio

4 Likes

Actually this did happen to me when debugging some scripts that same code in it and it broke the stop button multiple times, actually confused me a few times.

2 Likes

Can confirm that this is still happening. The tycoon game I am working on has each tycoon save data by an individual script, which uses BindToClose. After adding the ability to rebirth upon completing the tycoon, the old one gets destroyed, and thus this issue occurs.

There is no way of getting around it easily, so my request is for it to get fixed.