How does climbing work for X Position?

I understand you can hold W key to move up, and S key to move down. A + D keys though, when I try to manipulate the direction the players moving while climbing like this:

Root.Position + Vector3.new(1,0,0)

Sometimes it will move my player backwards instead of right/left on wherever I’m climbing. How do I fix this?

1 Like

Use CFrames to make the “right” direction relative to the root part to obtain Object To World Direction.

Root.Position + Root.CFrame*Vector3.new(1,0,0)

That sounds like it should work, since youre doing object to world orientation, but for some reason it just flings me when I set the position to that. Here’s an example of how that part looks:

			if Part then
				local up, left, down, right
				if UIS:IsKeyDown(Enum.KeyCode.W) then
					up=1
				end
				if UIS:IsKeyDown(Enum.KeyCode.S) then
					up=-1
				end
				if UIS:IsKeyDown(Enum.KeyCode.A) then
					right=-1
				end
				if UIS:IsKeyDown(Enum.KeyCode.D) then
					right=-1
				end
				BP.Position = Root.Position + Root.CFrame*Vector3.new(right or 0,up or 0,0)
			else
				Hum.AutoRotate=true
				PlayerClimbing=nil
				BP.Parent=nil
				RS:Disconnect()
			end	

What’s he’s doing here is wrong as it’s supposed to be:

Root.Position = Root.CFrame*Vector3.new(1,0,0)

but for some reason you can’t multiplicate a CFrame with a Vector3 anymore?
So what you could do instead is:

Root.Position = CFrame.new(Root.CFrame*Vector3.new(1,0,0))*(Root.CFrame-Root.CFrame.Position)

Do Root.Position += Root.CFrame:PointToObjectSpace(1,0,0)
The previous code you had moved you differently because it didn’t care where you were and where you looked, this on the other side takes in account your orientation too.

+= gives me a red line, is there another way I have to type it out because this is what I did:

				BP.Position = Root.Position += Root.CFrame:PointToObjectSpace(right or 0,up or 0,0)

Try using root.CFrame.LookVector it should help.

Exp:
X = LookVector.X * 1, Y = LookVector.Y * 1, Z = LookVector.Z * 1
Adding a CFrame’s LookVector to itself would produce a CFrame moved forward in whichever direction the CFrame is facing by 1 unit.

It will move the part based on x,y,z axes from where it’s looking at.

You don’t have to do BP.Position = …
+= already sets the value.

But I have to make the value the bp’s position? It’s the bodyposition’s property?

+= already does that, just copy my line.

I tried that, and I got an error.

BP.Position += Root.CFrame:PointToObjectSpace(right or 0,up or 0,0)

The error is that it’s a number, which isn’t a Vector3.

BP.Position += Root.CFrame:PointToObjectSpace(Vector3.new(right or 0,up or 0,0))
You forgot to wrap it up in a vector3 constructor.

Yeah that worked, but the same problem as before persists (flinging whenever I start to climb)

I adjusted my script so it checks if youre moving every 5 seconds to see if it’s another problem but when i climbed it attached me to the wall, however after 5 seconds the positioning was random.

That’s because it’s not moving you smoothly. If you want to fix it you’ve to redesign the moving system of roblox/use parts they used to make characters move.

I don’t understand what you’re saying

You’ve to make a transition between the movement, because the player is now just teleporting 1 stud to the left/right.

Do you go in the right direction with my method?

I can show a gif real quick here it is:

Is this the same error you had before?