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

What is the best way to disable control over the player?

I have been setting the controller object's parent to nil in order to make it so that I can use the method :MoveTo() while making the player have no control over their character. The problem is, however, that if a button is pressed down when the controller's parent is set to nil, the character will act as if the button was never released even if it was.

All the sources I found tell me to just wait until no buttons are being pressed and then disable the control. This however can loop on for as long as the player holds down a button, not a very professional feel if you ask me.

So that's why I have come here, does anyone know of a way to disable the control over the player's character without waiting?

(Please don't say anchor the character, then the method :MoveTo() will not function)

2 comments

1

I would like to know too. Anyone?

0

Curious as well

2 answers

Simply remove their jump power and walkspeed [set to 0.] and for more control, disable their mouse via userinputservice [and lock them to first person.]

More info on everything I just said can be found on Google.

I saw in another question something relating to the humanoids state.

Merely answered the question with

local Character = game.Workspace.Player1
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
Character.Animate:Remove()

Perhaps if you just DISABLED the animate script temporarily, and removed control, and enabled it again, that would work.

If what Merely said is correct, and it would behave like a normal part, this just might work to get around having to wait for disabled keypresses.

2 comments

0

This had me excited for a moment! After tests I found that the state changes back to walking so you'll still have to anchor the character :(

0

Maybe a changed event on the humanoid so whenever it changes, you change the state back. Or keep the animate script disabled? Custom animate script that doesnt change state?

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