How can I tween a Model position?

Hey there! I’m trying to tween a model position by changing it’s primary part position or CFrame and welding the parts (neither worked), but when the tween is played, only the primariy part position tweens, here’s the script:

local TS = game:GetService("TweenService")
local openPos = CFrame.new(0.85, 4.45, -8.263)
local closePos = CFrame.new(-3.35, 4.45, -8.263)
local debounce = false
local open = false
local PrimaryPart = script.Parent.Parent.Parent.Window
script.Parent.MouseClick:Connect(function()
	if not debounce then
		debounce = true
		if not open then
			local goal = {}
			goal.CFrame = openPos
			local tween = TS:Create(PrimaryPart, TweenInfo.new(1), goal)
			tween:Play()
			wait(1)
			open = true
		elseif open then
			local goal = {}
			goal.CFrame = closePos
			local tween = TS:Create(PrimaryPart, TweenInfo.new(1), goal)
			tween:Play()
			wait(1)
			open = false
		end
		wait(1)
		debounce = false
	end
end)

How can i fix this? Thanks (:

8 Likes

try change elseif with end if maybe it will work idk

There are no errors, it’s just the primary part that moves alone

Weld all parts in the model with the PrimaryPart. Make sure all of them are not anchored excepted the PrimaryPart. Make it anchored only.

13 Likes

It works perfectly! Thanks a lot!

1 Like

Fixed my issue too, Thanks ! :slight_smile:

2 Likes