I know, this may seem it would be used for bad intentions, but I promise, it wont.
I only want to do this because I wanna use escape to exit UI’s.
Unfortunately, Roblox has disabled API access to disabling the default Roblox settings.
You could probably use UserInputService to check if the player presses ESC and use TeleportService to teleport the player back into the game as soon as they do. They’ll still be able to open the menu, it’ll just close really fast. I’m not sure how to do it as I saw it in a YouTube video but I think it’d be easy (please don’t use this for bad though)
As said before, you can’t disable the default Roblox Menu. You can use Tab
for escaping your own custom menus however.