I pasted this in and it worked fine for me. You said the function does fire, but does it get past the disable line? Try putting a print statement after the line that disables CoreGUIs.
I’m not really sure what the problem is, since that line of code works for me. I wrote my own disable GUIs and even after copy pasting that line it still worked. Perhaps there’s another script interfering? If not, I’m not really sure if I can help. You could try just moving the disable GUIs on death code into a new place and then testing if it works, or sending the code for me to debug.
If by “not working” you mean it not disabling the menu button then let me inform you that this is intended behavior. Obviously, Roblox isn’t giving developers direct access to locking players into their games.
I have tried making another LocalScript and pasting that code in. Still didn’t work. I guess I haven’t really tried it in another place. I will try that asap.
Really the only thing I can think of is another connection that enables all core guis. Try doing ctrl+shift+f to search for all instances of a string, then type :SetCoreGuiEnabled and press enter. This may find any interfering code.