Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
5

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

Asked by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

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)

1
I would like to know too. Anyone? Perci1 4988 — 9y
0
Curious as well iaz3 190 — 9y

2 answers

Log in to vote
0
Answered by 6 years ago

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.

Ad
Log in to vote
-1
Answered by
iaz3 190
9 years ago

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.

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 :( BlackJPI 2658 — 9y
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? iaz3 190 — 9y

Answer this question