How do i add orientation (pls help)

I have a part, blue, that rotates, but very slightly in an eight pattern.


How can I add this orientation onto green, but also let green move around on its own?

i have been struggling on this question for months, no joke

Are you using tick() or os.clock() for the movement?

Can you provide the code?
char limit

uh i think so? idk someone made the loop script for me.

local runservice = game:GetService('RunService')

local pink = workspace.Pink
local part = workspace.blue
local x = part.Position.X
local y = part.Position.Y
local z = part.Position.Z
local speed = 5 -- feel free to change
local strength = 0.35 -- feel free to change

runservice.Heartbeat:Connect(function()
	local currentTime = tick() -- current time is the elapsed
	part.CFrame = CFrame.new(x + math.sin(currentTime*speed)*strength, y + math.sin(2*currentTime*speed)*strength/3,pink.Position.z-10)
	part.CFrame = CFrame.lookAt(part.Position,workspace.Pink.Position)
end)

uhh how? and why? this is the code that makes blue move, not green

is it a glitch or have you been really replying for the past 40 minutes?

I’m a little more confused now after re-reading your post a couple of times.

Do you want the blue and green part to move in the same way as each other except they are constantly out of sync?

I guess so. Think it like this. Green, can move in every way, just like normal. However, lets say that blue moves 15 degrees left. It will also make green move 15 degrees left. If blue moves up, green moves up, all whilst green is able to move normally. It’s kinda like a ghost in someone’s body, they can both move the body.

What do you mean by “can move normally”?


:confused:

For this looseness of the movement, you should rely on Roblox’s physics system and use the AlignPosition and AlignOrientation body movers. Instead of setting a position and orientation to the part, you would set it to the AlignPosition and AlignOrientation body movers.

This will require a lots of tuning to the body movers mentioned to make sure you get the exact behavior you are looking for.

Well that’s not going to fix everything, as it’s basically setting greens orientation to blues, but more smoothly. This does not let green move on it’s own

I was thinking about making a CFrame, and if blue moves, it would add it to green, and set the CFrame back to 0. If I just constantly add blues CFrame to green, it would just start spinning very quickly, as it’s just like adding 15 degrees to green over and over.

So you want the green part to be exactly like the blue part except the green part is in its own position but moves position wise like the blue part and its orientation is determined by Roblox’s physics engine?

Read this again. Green, moves, on, its, own. Blue, affects, its, orientation. If blue moves around, green moves around.