Cannot connect two parts together


so I have two parts here, the larger part and the smaller part. I added a weld constraint to connect the smaller part to the bigger part.
Screenshot 2022-07-18 at 8.42.21 PM
Screenshot 2022-07-18 at 8.42.29 PM
However when i set the position of the bigger part ( SlotsMachine ), the smaller part ( Seat ) doesn’t follow the bigger part as what the weld should be doing.
Am I using the wrong thing to weld those two parts together? Thanks

you can make seat child of Machine. Every time you move parent(Machine) seat will move too
but if you move child (seat) only seat will move
image

I am afraid that is just how building works but it doesn’t work for setting the position of the bigger part

Is the smaller part unanchored, whilst the bigger part is anchored? (Assuming you’re moving the bigger part by script, if not, unanchor the bigger part as well).

both parts are anchored
and I heard that some weld constraint motor6d things are required for linking two objects, I am not sure which one to use.

I believe Welds are required when you are Tweening an Anchored Part, but the connected Parts have to be unanchored.

I am using a weld constraint, I anchored part0 which is the bigger part and unanchored part1 which is the smaller part. It still doesn’t work

You could group them together as a model, then use the PivotTo() method to move it. It would look something like:

local model = workspace:WaitForChild() -- Machine and Seat Model
model:PivotTo(CFrame.new(Vector3.new(0, 0, 0))) -- PivotTo takes a CFrame so you can even change angles and stuff with it

Edit: This also keeps your Workspace organized because the seat and slot machine are grouped together.

I tried that out, it works like what I want ( two models moving together ) but the smaller part is also having the same position as the bigger part which is not what I want

Ah, you have place the small seat wherever it’s required and when you select each of the 2 Parts it will automatically set up the WeldC0 and WeldC1 to offset the weld.

Are you sure you aren’t running a weld script? Run the game in Studio and have a look in the Explorer inside both Parts. If you have extra welds in there then something else is going on.

@Cens_r don’t you also have to set the Model PrimaryPart when you do that?

Part0’s SlotsMachine ( bigger part ), Part1’s seat ( smaller part ). The two parts still don’t automatically link up when I set the position of SlotsMachine ( bigger part ) through a script
image

I just tried that out again with a different approach now it works with setting the position of it

clonedMachine:PivotTo(CFrame.new(item.Position+Vector3.new(0,4,1.5)))

the two parts now move together!
However there is one more problem. I can’t seem to rotate the whole model, same issue when I set the orientation of the bigger part, only the bigger part’s orientation is set and the smaller part doesn’t go with it
( the smaller part should be at the same side with the bigger part when the bigger part’s orientation is changed )

Have you tried to put them in a same model; while also adding a primary part in the mix?

I never really had an issue like that.

You will need to set the orientation through CFrame for both new weld constraints and “Weld” for the connected parts to follow as written in the documentation.

One way to do it is below by adding a orientation CFrame and position CFrame like below:

local positionCFrame = CFrame.new(item.Position+Vector3.new(0,4,1.5))
local orientationCFrame = CFrame.fromOrientation(x,y,z)
clonedMachine:PivotTo(positionCFrame*orientationCFrame)

x,y,z are in radians, to use normal degrees use math.rad to convert degrees into radians.

I believe either the big part should be anchored then moved with a script and the small part will follow, im not sure if it will work with the big part unanchored but it should.

1 Like

That doesn’t seem to work, and I’m trying to find a solution that doesn’t involve having to use that many maths.

Does setting the position of the BiggerPart versus setting the CFrame of the biggerpart affects the whole thing?
Hold on let me try it out

Update:
Using a weld constraint does change the position of the smaller part when I move the bigger part, however when I change the orientation of the bigger part the smaller part doesn’t follow it.

I couldn’t use a weld since that would mess up the position of the smaller part ( it moves the smaller part inside the bigger part )

you gotta unweld the seat or the constraint gon disable