Re-Enabled Player Controls Held Key Persistance?

So I’m using Humanoid:Move() in order to move a player in a direction and I don’t want the player to have control during this movement.

Because Move() requires a WalkSpeed of greater than 0, I cannot set the player’s WalkSpeed to 0. Instead, I disable their controls.

local Controller = require(game.Players.LocalPlayer:WaitForChild('PlayerScripts'):WaitForChild('PlayerModule')):GetControls()

Controller:Disable()
wait(1)
Controller:Enable()

Here’s the important part that is my problem:
If I hold down a movement key like W, disable the controls, and then re-enable the controls, I have to re-input W in order to begin moving again.

Is there any way at all to have the input persist so that I can be holding W and forfeit my controls, regain my controls, and not have to take my finger off of W?

This was asked once before but it didn’t seem to get an answer:

Couldn’t you just anchor the humanoid Rootpart instead since that does the exact same thing and you don’t have to let go of W

the player character will no longer move if i do this.

Yeah no, you have to unanchor the character duh

i don’t think you understand exactly what i’m looking for, so please re-read my post. the player has to move using Move(), and to do this the rootpart needs to be unanchored throughout the duration of the movement.

How about using the UserInputService, to see what key is being pressed, from a local script, and disable the controls temporarily, and then do an InvokeServer to a remote server function, passing the server the keypress used, and then reenable controls in the next line, after the Invoke (InvokeServer does not field until the function completes).

I’ve been looking at similar posts like this forever and was looking for a solution, but didn’t find a good one. I solved this by forking off of the roblox keyboard control module and changing the moveVector to Vector3.new(self.leftValue + self.rightValue, 0, self.forwardValue + self.backwardValue), then settings each of these values based on the current keydown using the userinputservice for keys asdw.

1 Like

What does the code look like for this?

Did you ever find a solution for this?

I copied the playermodule into startplayer scripts, and modified the control module in the way I detailed.

Great question Aqua. Looking the the same solution, but no luck yet. Best I can think of is forcing movement using humanoid:MoveTo after checking which keys are currently pressed using UserInputService:IsKeyDown(Enum.KeyCode.W) and so on. Turing into a mess. Your wording the the problem is very good and clear. Helped me find the post even though it is difficult to explain.

Try setting the player humanoid state to Physics