Im not sure how i could go about this but i want to replace click to move with something a bit different, i want the player to start heading straight toward the mouses position when mousebutton1 is down, how could i add this? I know i can use Humanoid:MoveTo() , my problem is figuring out how i can restrict the movement type to that one.
Just a short explanation, but when a player clicks it gets the mouse hit x, y, and z and makes the humanoid MoveTo() to the hit.
If what you’re trying to do is disable player movement through WASD then you can set DevComputerMovementMode to Scriptable. You can see and change computer movement mode in the properties of the StarterPlayers folder.
If you also want to call Humanoid:MoveTo()
for as long as left mouse is down, consider using ContextActionService or UserInputService to bind inputs. When the user presses the mouse button down, use RunService and bind a function that will call Humanoid:MoveTo()
. When the mouse is released, unbind the function. I suggest using RunService as opposed to a while wait()
loop because it will be far more accurate and on time with the user’s input.