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.
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
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).
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
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 )
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.
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 )