Need help detecting when player clicks X to close application/game

Roblox recently added a new thing where if you close the game by clicking the X (like most people do) it brings up an application menu thing. Well the problem is I have a custom mouse script because Roblox’s doesn’t let me change icon for when you hover buttons. And my mouse is stuck behind this specific UI.

I need to detect when a player clicks the X so they can have their regular mouse returned to them. Attached is example gif of what I mean.

https://gyazo.com/eac2b9ae4fbfff0e7bf0ec9a1c980674

As you can see my mouse is gone because I was using a custom mouse and made Roblox’s mouse invisible. I need to detect when this happens so I can make Roblox’s mouse visible again.

you could have a ui that is on the whole screen and use MouseLeave of the ui to see whenever the mouse leaves but i dont think its a good idea cuz sometimes it doesnt work

1 Like

I’ll keep that in mind as a bandaid solution if no one can tell me the syntax I need.

Players.PlayerRemoving event is fired whenever a player leaves the game.

https://developer.roblox.com/en-us/api-reference/event/Players/PlayerRemoving

This UI pops up before they leave, they are still in the game until clicking Leave. Problem is they can’t click Leave because their mouse is invisible and the ui is hiding the mouse I made for them.

I feel like this might be a bug because as you mentioned, the UI pops up before the player leaves, and I assume it’s a child of the CoreGui, therefore there’s no real way to detect it.

Try messaging @Bug-Support with your use case and include details

1 Like

It’s not a bug because the real roblox mouse is hidden due to me hiding it (i made my own mouse). I need to detect when this happens so I can unhide roblox’s mouse.

If they don’t have a way to detect this that would suck though…

When you say you made your own mouse, do you mean like an actual custom mouse, or do you mean you just changed the icon and/or are moving an image label to the mouse on renderstep/heartbeat/something else?

I mean a custom mouse image display. I tried changing the mouse icon, but roblox doesn’t let you pick an icon for when you hover buttons. So it just changes to their default button hover icon. So I made the mouse invisible and then created my own mouse by having an image go to my mouse location. That way I can just detect when I hover a button and have my own custom hover. This was perfectly fine until roblox added this new leave thing that covers my image.

Edit: I assume this will also be an issue for people that hide mouse for combat systems that they don’t want mouse shown in. Like melee combat system.

If you kick the player, does the mouse go back to the normal mouse? If so, I’m pretty sure it is a bug because this behaviour should be consistent with other CoreGui behaviour.

I don’t know about that but I noticed I can access their regular menu fine and main mouse shows up.

1 Like

Yeah, I’m pretty sure that would be a bug then as it’s inconsistent with other CoreGui mechanics.

1 Like

https://gyazo.com/4922a7f730ecba15dabac2b3928aab0c

Can you help me report this bug? It doesn’t let me post in Bug reports at all.
Maybe link this thread there for me?

Yeah, there’s basically no way that behaviour is intentional.

I don’t have permission to post there either, however you can send a private message to @Bug-Support and they should get back within a few days.

1 Like

Alright thanks for the responses. I messaged them.

2 Likes