How would I only move on 1 axis?

Currently, I have this set up, where the player can rotate and go back and fourth.


What I want to happen is where it just goes in 1 axis, and it ignores the rotation. I don’t think I’m explaining it that good, so here’s kinda how I want it.

I have the moving as…

humanoidRoot.CFrame = humanoidRoot.CFrame * CFrame.new(0.2,0,0)

…and the rotation like…

humanoidRoot.CFrame = humanoidRoot.CFrame * CFrame.Angles(0,0.1,0)

I’ve tried to find solutions, but I don’t think I was describing what I wanted correctly.
How can I switch it to how I want?

Instead of moving it using CFrame, you could use Vector3s as they will get added in an absolute way instead of relative

e.g: humanoidRoot.CFrame = humanoidRoot.CFrame + Vector3.new(0.2,0,0)

1 Like

Now I feel dumb because this was my first thought when I started, but I didn’t do it lol.
Thanks!

1 Like
CFrame.new(RootPart.Position) * CFrame.new(0.2, 0, 0)

In case you prefer to work with CFrame values.