Game.OnExit callback for when player closes window

Game.OnExit would let you run a function when the player exits the game. Your function runs before the game exits, closes the Esc menu, and lets you do things like pop open a gui saying ‘Warning: if you leave you will lose your match bonus!’ and other things.

4 Likes

What if you press the X or alt+f4?

Windows programs have the ability to put warning boxes when the user does that.

Suggestion for a title that actually fits the 15 characters requirement:

Game.OnExit callback for when player leaves the game

1 Like

This is exactly why it’s not going to happen. Further, it serves no practical purpose since it’s not going to work in multiple situations such as disconnections.

1 Like

…so because a feature won’t work in rare scenarios we shouldn’t have it?

I then point you to the main subject of my response. You’ve made a major flaw in the design of your game if you need to warn users before they leave they will lose progress. Not to mention it’s irritating and it will certainly be used in the wrong way. I am fairly certain not even apps are allowed to do this.

2 Likes

I don’t think you should assume things like that when you’ve not been given any evidence to suggest that.

Many games do what I do. Look at battlefield and cod. You get exp while playing and a match bonus for finishing the game.

They don’t ask you to confirm leaving a game though. They inform the user by saying “End of match bonus” and make is fairly prominent. If you can’t get your players to complete a single match, you have bigger problems than this.

All sites I see use the “Do you want to leave this page?” dialogs tend to be less reputable

4 Likes

Look at other games with this like MMORPG’s that ask you if you want to leave because it’ll forfeit your Mach bonus and literally every game out there that asks you if you’re sure you want to exit the game.

This is only the case if you close it via buttons they’ve implimented to close the application. If you use Alt+F4 then it’ll close regardless and you’ll be informed when you open it again.

1 Like

No game does that if you close the application, only when returning to the menu which is something you can script yourself

1 Like

I see that this can be useful to see if the user exited the game or disconnected.
Many players that plays with a friend leave the server because when the other player disconnects they think the player exits the game and don’t want to play anymore, happens much to me, so this is something this feature can be used for.

The event itself might be useful for displaying disconnect messages but shouldn’t yield to display a popup

1 Like

I was thinking about this a bit ago. I don’t script but if I did I would map out the region up in the corner next to the X button, the mouse hovers up to the X a loud sound plays and a GUI appears telling the player if they stay they get a reward or click this button to receive an extra ingame item or currency in 5 min.

While playing GTA V, it doesn’t matter how much you spam Alt+F4, it will still show a warning message confirming that you want to leave the game. I know the same is true for many competitive games, it’s definitely possible.

1 Like

This is a perfect example of why this should not and never will be a feature.[quote=“Kensai666, post:16, topic:22320, full:true”]
While playing GTA V, it doesn’t matter how much you spam Alt+F4, it will still show a warning message confirming that you want to leave the game. I know the same is true for many competitive games, it’s definitely possible.
[/quote]
It’s very easy to disable this, as I and many other users have done so.

If this feature were to exist then expect to see 90% of games using it to stop you leaving when you want to leave. If I click close, I expect my window to close. The only ‘positives’ that this has to offer arise when somebody is making poor design choices.

If your game requires users to click a save button, rather than slowing them down when they want to do something else, periodically backup their progress and offer them the option to load that when they next play.

I’m not arguing with you about this. It’s considered an industry standard. I can tell you for certain that this isn’t going to happen.

ROBLOX already has a confirmation window if you leave through the menu, adding another one on top of that by the game itself would be extremely bad for user experience.

Apart from that, if I hit the X or do Alt+F4 as a user I expect the game to close immediately for a windowed game. I guess this can be personal bias, but I would get irritated if a game prevented me from leaving after performing the action to leave. I don’t think GTA etc are good examples because they are standalone games that are mostly played in fullscreen.

2 Likes

That’s why this should be a designer’s choice. Look at CS:GO, Rocket League, and a few other competitive games where it was the designers’ choice to put in an extra dialog to let them know; ‘Hey something bad might happen if you quit in the middle of a match!’. I would never call that a ‘poor design choice’.

But as long as ROBLOX can PROPERLY implement this, it could be useful for developers.

Now I’m not saying that some wouldn’t try to keep others in their game using it, but that is why it should be the designers’ choice; be it bad or good. There are more positives for this feature than negatives(if implemented properly), and if you use a process kill-switch, this feature shouldn’t affect you in any way.

I only see a single use-case for it and the majority of posters here seems to think that the use-case is shady behaviour, so I’m not sure if everyone sees it that way.

1 Like