Rolling the player left and right

When left ctrl is pressed while A or D is held down, the player rolls either left or right.
This works fine when the player is facing a certain direction.
https://gyazo.com/b4e6039de9da0f3fe49d63a53946aa61

However, when turned 180, the player is moved in the opposite direction of the key pressed (e.g, A moves right instead of left).
https://gyazo.com/6c6ad581b2b67023ced9152a1e820c96

So I’m wondering, what am I doing wrong with the way I’m moving the player in their correct direction?

local function Roll()
	RollStartTime = tick()
	RollDirection = Vector3.new(Humanoid.MoveDirection:Dot(camera.CFrame.RightVector),0,0)
end

RunService.Heartbeat:Connect(function() 
	local dT = tick()-LastBeat
	LastBeat = tick()

	if tick()-RollStartTime < .75 then
		HRP.CFrame = CFrame.new(RollDirection*dT*15) * HRP.CFrame
	end
end)

Bump

2 Likes

Not sure what this part does, but i made the exact same dash system using only

humanoid.MoveDirection

and it works perfectly fine

1 Like