One “trick” usually used to disable the player’s movement is to use ContextActionService to unbind the keys WASD.
local ContextAction = game:GetService("ContextActionService")
function sinkInput()
return Enum.ContextActionResult.Sink
-- Sinks the key so that no action is taken.
-- Since this will be the most recent bind to the key, it takes priority over default movement.
end
-- Disables movement.
function disableMovement()
ContextAction:BindAction("DisableMovement", sinkInput, false,
Enum.KeyCode.W,
Enum.KeyCode.A,
Enum.KeyCode.S,
Enum.KeyCode.D
)
end
-- Unbinds our "disable movement" so that the default keybinds are activated.
function enableMovement()
ContextAction:UnbindAction("DisableMovement")
end
Clarify why on earth you’d disable the controls then want to know if the player is moving. If you want to determine the velocity of the player then use BasePart.Velocity
Well, that’s why i said this may be an odd question.
I want to do that wherever people using WASD, gamepad leftstick or mobile stick, i could get which the player input like when i holding AS or make sticks to Left Down, GetMoveVector returns -1,0,1
Actually I’m coding a camera script, the camera type like League of legends but moving with GetMoveVector.
If you want to disable the controls and read off of the input I assume you’ll have to construct your own version.
Structure it like so
local Movement = {
X = 0;
Y = 0;
}
Then add connections to the controls and determine an appropriate camera movement ratio for the control. Using input keys you will need to use while loops to constantly get the movement. For gamepads use inputchanged to input the vector2s.
Then use a RenderStepped connection to move the camera based on the movement determined by the input OR just call a function the moves the camera by x amount.