Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to remove character control?

How do you make it so that a player loses control of their character? As in, when they press the arrow keys they do not move? I thought that what gave Players control was the HumanoidRootPart, but deleting it just made my character sink through the ground, so now I'm stumped.

(what I'm really trying to accomplish is how to make it so that the Player can't move their character around, and this was the only way I could think of).

1 answer

Every player has a Controller object in the ControllerService. Removing that object will prevent the player from controlling their character, and putting it back gives them control of their character again.

Here is an example from the wiki. (This is done from a local script.)

local controllerService = game:GetService("ControllerService")
local controller = controllerService:GetChildren()[1]
controller.Parent = nil --Removes control of the character.
wait(5)
controller.Parent = controllerService --Gives control back.

2 comments

0

Does each player have their own Controller and ControllerService, or will parenting the Controller somewhere else make every player on the server lose control?

0

Each player has their own controller. However, it's only accessible locally. You cannot remove a player's control from a server script.

This discussion is preserved as it was. New answers, comments, and votes are closed.