This doesn’t work well with the emulator mode in Roblox Studio. If you’re testing with a real device, it should work fine.
Also I find that this sometimes doesn’t work when being called immediately. I would wait until the character is spawned before setting ModalEnabled to true.
Emulator mode in Studio is completely broken in my experience.
But this is with a real device.
If it is invalid to set it at certain times that should be documented and setting it at the wrong time should raise an error. I don’t have time to hunt down every weird edge case in ROBLOX to get my game working.
Have you tried setting it in a local script in StarterGui? That’s what I do and seems to work fine. Also when I use it, 25% of the time it doesn’t go away for some reason.
I have reported the bug and I have hacked around it. Just like everyone. Done with this one.
I found out the right way to disable it is to create a dummy script with a special name and sticking in in a special place. I found this out by asking a random guy named Kyle. I don’t know how anyone else is going to figure it out.