Lock player actions and show modal

Hey. I want that under some conditions particular player actions are locked (can’t walk, jump, look, etc.) and show a screen space Modal gui. How could I do that?

Show the GUI as you would any GUI. Grab the Control module from PlayerScripts, and call Disable() (or Enable(false)) on it.

local Control = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild('PlayerModule'):WaitForChild('ControlModule'))

Control:Disable()
2 Likes

Can I dot this from Script and not LocalScript? As local stuff can be exploited.

Given you are showing a GUI on the players screen, and you are wanting to change how the user input gets handled, it pretty much has to be a local script.

The player’s screen and their input is all handled locally by their PlayerGui and the ControlModule.

You can ask the client to do it from the server using a RemoteEvent, but ultimately the client has to respect the request.

If you want some additional checks, you can check for movement on the server after you’ve asked the client to stop, and if they continue moving after accounting for the time taken to react to the request, then you can treat them as an exploiter.

1 Like