I’m trying to create a 2D game. I want to figure out how to stop characters from turning around like this. I can stop them from moving forwards or backwards, but I’m not sure how to fix this. I want them to face a set direction.
I am no pro at coding but I would do it like when for example A is pressed the characters rotation will change immediately.
You can unbind the sideways movement keys. Alternatively if you have to, try unbinding the W
or S
keys. It kind of depends on the camera angle I guess?
You can unbind the movement actions using the :UnbindAction
method of ContextActionService
. You just pass the action name.
UnbindAction("epic action name here")
https://developer.roblox.com/ko-kr/api-reference/function/ContextActionService/UnbindAction
You can find the name of the movement actions in the Developer Console.
Here is a short list I made for you though:
- moveBackwardAction
- moveForwardAction
- moveLeftAction
- moveRightAction
- jumpAction
I guess I should update this in case anyone ever needs it. Found out its Humanoid.AutoRotate = false. It also stops turning with shift lock.