I’m trying to use PlayerModule:GetControls() to avoid messing with walkspeed, and jumpheight values since my game constantly changes them
If you are holding W,A,S,D, or any key that moves you in any way, when controls are re-enabled you do not instantly start moving again. You have to let go of that key and press it again. It’s kinda clunky, and I’d prefer to not have it that way.
No idea where to begin to begin fixing this
local LocalPlayer = game.Players.LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
task.wait(5)
Controls:Disable()
print("disabled")
task.wait(2.5)
Controls:Enable()
print("enabled")
1 Like
Try checking if the player is holding any of the keys once it enables using UserInputService
local userInput = game:GetService("UserInputService")
if userInput:IsKeyDown("W") then
--code
elseif userInput:IsKeyDown("A") then
--code
elseif userInput:IsKeyDown("S") then
--code
elseif userInput:IsKeyDown("D") then
--code
end
I’m not sure how to move the character afterwards, but this should provide a base to check if the character is trying to move once the controls enable.
1 Like
I should’ve thought of that. I think to get the player moving again it’ll be something related to the movedirection property of the humanoid
1 Like
The MoveDirection
property of the humanoid is read only, and cannot be modified by scripts.
Yeah, but it could help us get the number we need to insert in the brackets Humanoid:MoveTo()
If i’m being dumb tell me please