Tweening model leaves some children of the model behind

So, I have a function that tweens a door model out, waits some time, then in. Here it is:

local Move = function(Model, ToCFrame, TimeOfDelay)
		if Mode == "Fast" then
			wait(TimeOfDelay)
			
			Model:SetPrimaryPartCFrame(ToCFrame)
		elseif Mode == "Tween" then
			local CFrameValue = Instance.new("CFrameValue")
			CFrameValue.Value = Model:GetPrimaryPartCFrame()
			
			CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
				Model:SetPrimaryPartCFrame(CFrameValue.Value)
			end)
			
			local Info = TweenInfo.new(TimeOfDelay, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
			local Tween = game:GetService("TweenService"):Create(CFrameValue, Info, {Value = ToCFrame})
			
			Tween:Play()
		    Self = Tween.Completed:Connect(function()
				CFrameValue:Destroy()
				Self:Disconnect()
			end)
			
			wait(TimeOfDelay)
		end
	end

robloxapp-20200507-1121421.wmv (2.8 MB)
Anybody know what I did wrong?

1 Like

Issue is fixed. Some of the parts were not anchored.

Make sure to mark as solved so we know that it is from the main page.

Not exactly on topic but I recommend tweening your model by welding all related parts to it as opposed to using this method. I have a tutorial on model tweening which explains some of the downfalls of this practice. See here:

tl;dr - SetPrimaryPartCFrame is bad when called in excess.

1 Like