Adjusting Position based on a part's angle

Hello, what I’m basically trying to do is move a part along lets say the player arms, I recorded a quick gif to explain what I am trying to do.


I’m trying to do something like the parts on the left side of the screen, and NOT the right. Can anybody tell me how I’d do this?

example: clone a part and parent it to the players arm (R6) that moves down the arm and ends up by the “hand” area no matter what the rotation/orientation of the arm may be.

Any and all help is heavily appreciated, I’m a solo dev who’s self taught so any and all help goes a long way. Regardless, thank you if you even just read this far.

3 Likes

have you tried using cframes?, im new to this scripting thing but i think it’ll help

I feel like you can move the object using a script and moving it from the local position of the arm of the arm. i am still new to scripting but i hope this helps

1 Like

There are two ways (from what I know) to do this. First one is using the method CFrame:ToWorldSpace().

part.CFrame = arm.CFrame:ToWorldSpace() * CFrame.new(Offset) -- Offset is a Vector3

Second one is using LookVector, UpVector or RightVector to get this effect. Don’t get confused by XVector, YVector or ZVector, they work exactly the same as the other ones.

part.CFrame = arm.CFrame + arm.CFrame.YVector * 1 -- how many studs it should move in the direction

When you need to move a part in multiple vectors, like up and left, it’s better using the ToWorldSpace() method. But if you only need to move the part in one vector, the second method gets the job done.

1 Like