How to disable a chosen players controls on server side?

I’ve seen a lot of posts about this but they all seem to be client sided. I was wondering if it is even possible to disable/enable a players controls on the server side.

I am trying to make an attack that when the top player presses a button, it triggers a RE and a ServerScriptService script plays an attack on a player that was chosen, though one of the attack effects involves the player not being able to control themselves. Is there anyway I can disable the chosen player’s controls in the same script as the attack sequence which is in ServerScriptService?

This is what I have right now but it has not been working for hours:
This is part of what is under the RE OnServerEvent function

local nearestplr = FindNearestPlayer(block.Position) --function I already created
local char = game.Workspace:FindFirstChild(nearestplr)

--disabling controls
	local PlayerModule = require(game:GetService("Players"):WaitForChild(char.Name).PlayerScripts:WaitForChild("PlayerModule"))
	local Controls = PlayerModule:GetControls()

Sorry if this might not make sense I’m still learning client/server sided stuff.

You’re kind of approaching this in the wrong direction. The client receives input, which is sent to the server to do a certain task/action with said input. There’s theoretically nothing wrong with disabling input from the client depending on what the input is.

What kind of input are you trying to disable? If this is just basic character movement you can do this on the client, or alternatively set the characters walkspeed and jumppower to 0.

1 Like

Disabling player control inputs from server without using remote events is just not possible because PlayerScripts inside player objects doesn’t replicate to server.


So I have a button in a UI on the client side so that the server side can perform the attack, and in this attack I need the player to lose control of themselves.

I’m trying to get the player to not be able to move because I am moving the character with the attack script onto a giant slingshot and I want the player to be moved onto the slingshot with the script and stay wherever the script says to be and the player can move out of it. After a second of sitting in the slingshot the player is flung.

Would making the player speed an jump power to 0 work in this case?

No, changing the walkspeed wouldn’t work if you’re going to be manually moving the character. Here’s a solution from a related post that may be beneficial to you:

Full disclaimer that this will involve you having to use a RemoteEvent from the server → client.

1 Like

Okay so I would make a remote event to disable the controls, then later in the attack event I would make another remote event to enable the controls again?

Or would I not need to enable the controls again if the player is going to die anyways. (In other words, if the controls are disabled and the player dies, are they enabled automatically when they respawn?)

You can use the same event and pass a parameter to the client telling it if controls need to be disabled or enabled. Alternatively just use a variable in a LocalScript to track if input is currently disabled/enabled.

As for handling characters respawning, you can also create a “state” for every player on the server and use that as a reference if their input should be disabled. When their character loads, compare the state in a CharacterAdded event and fire the remote again if their input should be disabled.

Edit: The second short paragraph I mentioned would also be important for security. Because client is received by the client, assume any malicious player can re-enable their input. By tracking if their input should be disabled on the server you will be able to kick a player who is moving when they shouldn’t be able to.