Hello there! So I’m trying to make a game and when an event is triggered blast doors will close. Now i coded the door but my problem is that only one part moves. I’m not sure how to attach the other parts in the model to move with the main door. Any help? Thanks!
Use weld constraints? Maybe that will work.
Uhh… maybe I’m just inexperienced but I don’t know what those are
You should look into @colbert2677’s awesome tutorial on tweening models.
Create a part to act as the root for your model. Use Weldconstraints to weld your other parts to the root.
There is no need to weld anything (though it is an option), what you could do instead is tween the PrimaryPart’s CFrame.
You need to create a CFrame value,
local Model = script.Parent -- define model; make sure you have set a primary part.
local Value1 = Instance.new("CFrameValue")
Value1.Value = Model:GetPrimaryPartCFrame()
local OriginalCFrame = Value1.Value
Here we are setting the Value of the CFrameValue (Value1) to the current CFrame of the model.
Then you would need to tween the CFrameValue.
TweenService:Create(Value1, info, {Value = (OriginalCFrame) * CFrame.new(0,0,0)}) -- amount to move (XYZ)
Then you would have to set the PrimaryPart’s CFrame whenever it changes, in this case whenever it tweens to a new position.
Value1.Changed:Connect(function(NewValue)
Model:SetPrimaryPartCFrame(NewValue)
All you have to do is create a weldconstraint, set the part0 to the part you want to move, and set part1 to the part that already moves. Then unanchor the part you want to move. You can just keep doing this until everything moves.