Parts not moving with welded primarypart while using cframe

I’m trying to make an infinite elevator with different varying sections, so I’m having the script pull a randomized section out of a folder in serverstorage and moving the main part of the welded model to the designated location. I looked at a couple different posts that all said to use cframe instead of position, I did, and it still has the same result. The script moves the primarypart perfectly fine, but the other parts are still stuck.

Weld Script

local Lights = game.ServerStorage.Lights
local CloneFolder = game.ServerStorage.ShaftCloneStorage
local PipeModel = game.ServerStorage.BluePipe

for i,Section in pairs(CloneFolder:GetChildren()) do --welds all sections
	for i, Part in pairs(Section:GetChildren()) do
		if Part.Name ~= "Main" then
			local Weld ="WeldConstraint")
			Weld.Part1 = Section.PrimaryPart
			Weld.Part0 = Part
			Weld.Parent = Section.PrimaryPart
			Part.Anchored = false

for i, LightModel in pairs(Lights:GetChildren()) do --welds all lights
	if LightModel.ClassName == "Model" then
		for i,Part in pairs(LightModel:GetChildren()) do
			local Weld ="WeldConstraint")
			Weld.Part0 = Lights.PrimaryPart
			Weld.Part1 = Part
			Weld.Parent = Lights.PrimaryPart
			Part.Anchored = false

for i, Pipe in pairs(PipeModel:GetChildren()) do --weld pipes
	if Pipe.Name ~= "Main" then
		local Weld ="WeldConstraint")
		Weld.Part0 = PipeModel.PrimaryPart
		Weld.Part1 = Pipe
		Weld.Parent = PipeModel.PrimaryPart
		Pipe.Anchored = false

Part Movement Script
(only using one section for testing purposes)

--Spawn Elevator Shaft
local sectionY
local pipeY --declares variable here to increase scope
for i = 1,30 do
	if i == 1 then
		sectionY = -8.65 --lowest spot the shaft will always be
	local shaftClone --increase scope
	local sectionSelection = math.random(1,2) --picks shaft
	if sectionSelection == 1 or sectionSelection == 2 then --1/4 chance to pick the empty shaft
		sectionSelection = "Section"..1 --picks section 1
		sectionSelection = ShaftCloneStorage:FindFirstChild(sectionSelection)
		shaftClone = sectionSelection:Clone() --clones it
		shaftClone.PrimaryPart.CFrame =,sectionY,0)
		shaftClone.Parent = ElevatorShaft
		lightClone = LightCloneStorage:Clone()
		lightClone.PrimaryPart.CFrame =,sectionY,0)
		lightClone.Parent = ElevatorShaft
	if sectionSelection ~= "Section4" then
		local pipeClone = BluePipe:Clone()
		pipeClone.PrimaryPart.CFrame =,sectionY,0)
		pipeClone.Parent = shaftClone
	sectionY = sectionY + 48.9 --distance it takes to get to the next shaft position

primarypart is at the top

So you have the PrimaryPart set on your model and it is all welded (not sure if that is really needed unless it is designed to move), so all you need to do is set the CFrame of the Primary Part. I use the following quick function:

local function cloneModel(clone, spawnPos)
	local modelClone = clone:Clone() 
	modelClone.Parent = pickups

Then to clone a Model from ServerStorage I just use:

cloneModel(item, pos)

I expect your problems arise from not using SetPrimaryPartCFrame on your Model

1 Like