Roblox CFrame Help

How to use CFrame with Weld Constraint? I need to change the position of the red cube using CFrame, but the position of the entire model changes


The devhub article says that parts will update if you change the connected part’s CFrame, but not with position changes. Either use the position property or temporarily disable the constraint before moving.

1 Like

workspace.Test.RedPart.CFrame = workspace.Test.RedPart.CFrame +,10,0)
Correct, or somehow change?

1 Like

I need the constraint to work at the time of moving.

1 Like

This is a bit more complicated. What I don’t understand is whether you even need a weld constraint here. Manually CFraming them would be much easier if those parts can be left anchored.

If they can be left anchored, this code is good enough:

local posRed0 = partBlue.Position
local posRed1 = posRed0 +
local posBlue0 = partBlue.Position

partRed.CFrame = CFrame.lookAt(posRed1, posBlue0)
partBlue.CFrame = CFrame.lookAt(posBlue0, posRed1)
1 Like

Details not anchored. I need the gray part to be able to lie on the floor, but when the red cube gets close to the ground, it is pushed up.

1 Like

In that case you’ll need to use the AlignOrientation constraint. I’m not very knowledgable with those, so I can’t help you much.

1 Like