Hello. I already have the code but I don’t know exactly how to make the player walk on X axis only.
Run.RenderStepped:Connect(function()
HRP.CFrame = CFrame.lookAt(HRP.CFrame.Position, Vector3.new(Mouse.Hit.Position.X, HRP.CFrame.Position.Y, Mouse.Hit.Position.Z))
Humanoid:MoveTo(Mouse.Hit.Position) -- I only need the X-axis.
end)
Do Mouse.Hit.Position.X to achieve it.
Thanks for the idea. However, it gave me an error “Unable to cast double Vector3”. I already fixed it by doing this.
Humanoid:MoveTo(Vector3.new(Mouse.Hit.Position.X, 0, HumanoidRootPart.CFrame.Position.Z))
end)
Well, for a click to move, just do Humanoid:MoveTo(Mouse.Hit.Position.X, HumanoidRootPart.Crame.Y, Mouse.Hit.Position.Z)
idk why u would want to do this but your choice
1 Like
I am making a 2D kind of game so I only need the X axis for the player to move. I don’t want the players to go towards the camera while moving their characters with their mouse.