This sounds like something extremely easy that can be googled, but everything I tried didn’t work.
What I’m trying to do:
After geting knocked back, the character is down on the ground. When the player tries to move the character, the humanoid’s MoveDirectionProperty changes but the WalkSpeed is 0 to prevent walking. I’m trying to make the character face toward the humanoid’s MoveDirection property before the character rolls.
Example:
This is done with the humanoid’s AutoRotate, not by setting orientation. Turning to the direction is delayed.
Attempts:
- Setting the Orientation directly caused the character to face up and glitch in place running.
- I tried to make the hrp face a position 1 stud away in the MoveDirection:
(hum = Humanoid, hrp = HumanoidRootPart)
local x
local z
if hum.MoveDirection.X < 0 then
x = hum.MoveDirection.X - 1
else
x = hum.MoveDirection.X + 1
end
if hum.MoveDirection.Z < 0 then
z = hum.MoveDirection.Z - 1
else
z = hum.MoveDirection.Z + 1
end
print(hrp.Orientation)
hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(x, hrp.Position.Y, z))
print(hrp.Orientation)
Result:
![]()
The baseplate isn’t moved up. The hrp is the grey box in the video, it shouldn’t be over 20 studs high.
- Making hrp face 2 studs away:
print('MoveDirection '..tostring(hum.MoveDirection))
print('Position '..tostring(hrp.Position))
print(hrp.Orientation)
hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(hum.MoveDirection.X, hrp.Position.Y, hum.MoveDirection.Z) * 2)
print(hrp.Orientation)
Result:
![]()
- Setting WalkSpeed to 1000 to make AutoRotate faster and setting it back to 18 right after destroying the roll LinearVelocity
Result: The WalkSpeed didnt go back to 18 and the character almost ran off the baseplate
The y value should be 0. Help Im stuck T-T
Edit: The roll orientation is wrong in any direction except exactly forward. The MoveDirection property is a Vector3 that changes from movement input (w, a, s, d, mobile/controller joystick)