How do you move the character's velocity based on the key pressed?

What im trying to accomplish is that the player will dodge to the left, right, etc based on the keys pressed (A,D) instead of dodging to the front or what the player is facing.

So far this is the only thing close to what i’m trying to accomplish.

UIS.InputBegan:Connect(function(input)

if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
		
		if input.KeyCode == Enum.KeyCode.A and debounce == false then 
			
			debounce = true
			
			HRP.Velocity = character.HumanoidRootPart.CFrame.lookVector * 1000
			
			
			wait(cooldown)
			debounce = false

            end
end

LookVector only pertains to the forward direction of the CFrame, whereas RightVector pertains to the right side of the CFrame. LeftVector doesn’t exist, however, you can do -CFrame.RightVector.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.