How to add position to a part relative to another part?

Hello, I created a levitation script. When the character points up, the levitating object goes up, same with down, left and right. The problem is that in my method, if the char goes behind the object (in world space), the movements become inverted, sinse the scripting is adding worldspaced vector3 to the object position. What I need is to make the object go aways to the Char’s right when I press to go right, and not the world’s right.

So the scrips now is like this: (in a loop, using BodyPosition mover)

TargetsBodyPosition.Position = target.Position + Vector3.new(inputX, inputY, inputZ)

How should I fix it?

HERE IS AN IDEA OF HOW IT SHOULD WORK

This video I uploaded, it only looks like working because the char is facing the right direction.

VIDEO SHOWING THE PROBLEM

You will need to use CFrames to achieve this function. In particular, you will want to use CFrame.LookVector which gives the position and orientation relative to the object.

Using the position property only gives the numerical position and not the direction Of orientation of the object, so adding to this position property is doing so in world space and not relative to the object.

i know, but i dont want only to move the object relative to itself, its own look vector, but I want it to move according to another part look vector. How do i do that?

Maybe I am misunderstanding your question? Don’t you just obtain the CFrame lookvector for the other object?

How?

I dont get ur answer too.

I’m not sure if I understand properly, but from what I do understand, you want to move the part based on the character’s rotation. in that case, you can do

part.CFrame = humanoidRootPart.CFrame * CFrame.new(x,y,z)

I tested, this makes the part goes directily to the HumanoidRootPart position and add XYZ to it. I want the part to move according to its own position but player’s lookvector

I mean, i made “BP.Position = (root.CFrame * CFrame.new(mx,my,mz)).Position” because im using body mover

You want to rotate it based on the character’s rotation?
Can’t you just do

part.CFrame = CFrame.new(part.Position,hrp.Position)

HERE IS AN IDEA OF HOW IT SHOULD WORK:

This video I uploaded, it only looks like working because the char is facing the right direction.

I dont want to rotate the part. I want it so when i press to go Right, it goes to my chars right direction (but stays relative to its own position)