Tweening a gate open

I am trying to make a script that will tween my gate model open.
However, it isn’t working as expected (as you probably thought) and is moving in a weird way.
At first it was moving even weirder but I fixed that part by also tweening the parts rotation.


Script:

for _,v in pairs(script.Parent.Gate:GetChildren()) do
	game:GetService("TweenService"):Create(v,TweenInfo.new(4),{Position = script.Parent.GateO:FindFirstChild(v.Name).Position,Orientation = script.Parent.GateO:FindFirstChild(v.Name).Orientation}):Play()
end

Explorer:

image

Try to tween the rotation of the entire gate model

I am. The rotation is the orientation part.

I think this is happening because the post needs to be tweened with respect to the planks’ lengths. If I were you, I would just unionize the parts which comprise the gate and tween the following union accordingly.

Edit:

If you unionize the gate and insert it into a model, you can create an invisible post and use it as a primary part so you only need to tween the rotation of the primary part’s CFrame.

Of course all parts are getting tweened since you are tweening every descendant of the model. To fix the issue you want to make a primary part for the model.

image
Clone this bar (make it invisible) and set it as the model’s PrimaryPart, weld all the other parts to the cloned part (hinge) using a weld constraint (to speed this operation up you can use this plugin), make sure that all the constraints are active and then instead of tweening every part just tween the hinge, this way since the parts are welded to it they will move too but this time moving according to the hinge.

If you find my way of explaining what i meant hard you may try with this tutorial: How to Tween / Animate a Door [2021 Tutorial] - Roblox - YouTube which uses the exact same concept and also explains how to use the plugin.