Moving primary part doenst move whole model

  1. What do you want to achieve? Door

  2. What is the issue? Only primary part move, if whole model move then I change to rotation then work.

  3. What solutions have you tried so far? Everything under thy sun. Most sources said just to move the primary part.

Please give full in-depth explainations so I can learn what I did wrong here.

local Door = clidec.Parent.Parent
local hindge = Door.Hinge
local hindgeend = Door.HingeEnd

Door.PrimaryPart = hindge
Door:SetPrimaryPartCFrame(hindge.CFrame)

local debounce = false

local function click()
	if debounce == false then
		debounce = true
		local Attribute = Door:GetAttribute("Open")

		if Attribute == "False" then

			hindge.Position = Vector3.new(0,0,0)

			Door:SetAttribute("Open", "True")
		elseif Attribute == "True" then

			hindge.Position = Vector3.new(5,5,5)

			Door:SetAttribute("Open", "False")
		end

		debounce = false
	end
end

clidec.MouseClick:Connect(click)

Here is a script that kinda works but i want it to tween on the hindge and in this version it just teleports. Idk how to tween it on the hindge without primary parts / models.

local clidec = script.Parent
local Door = clidec.Parent.Parent
local StartPos = Door:GetPivot()
local EndDoor = Door.Parent.EndDoor
local EndPos = EndDoor:GetPivot()

local debounce = false

local function click()
	if debounce == false then
		debounce = true
		local Attribute = Door:GetAttribute("Open")

		if Attribute == "False" then

			Door:PivotTo(EndPos)

			Door:SetAttribute("Open", "True")
		elseif Attribute == "True" then

			Door:PivotTo(StartPos)

			Door:SetAttribute("Open", "False")
		end

		debounce = false
	end
end

clidec.MouseClick:Connect(click)

I think when dealing with moving a whole model, all other parts have to be welded or weld constrained to the primaryPart, and you have to use CFrame not Position, although I’m not 100% sure.

1 Like

Weld Every part in the door to a PrimaryPart then Tween PrimaryPart CFrame to the EndCFrame. Without welding them to the PrimaryPart and trying to move PrimaryPart it will only Move PP and the rest will stay the same.

You can use TweenService to Tween Cframe