Weld Constraints not working?

I’m new to modelling and scripting but I’m attempting to make a model follow my character by using Weld Constraints to hold the entire thing together, then CFrame the Primary Part of the model so it follows me. I am trying to avoid using Instance:SetPrimaryPartCFrame() as it appears to be broken currently and slowly tears models apart, causing them to become deformed. Thing is, the Primary Part is the only thing that seems to be following my character and the rest of the model is left behind. I tried unanchoring the rest of the model but that just caused it to all fall apart. Every part in the entire model is a MeshPart imported from blender, but I don’t think that changes anything although I could be wrong. I will add my script below. There are no errors when I run it. This is all being done in a Server script.

ghost = script.LastCityGhost -- Model name
decs = ghost:GetDescendants()
local HRP = script.Parent.HumanoidRootPart

for i,v in pairs(decs) do
	if v.ClassName == "MeshPart" then
		local weld = Instance.new("WeldConstraint",ghost.PrimaryPart)
		weld.Part0 = ghost.Eye
		weld.Part1 = v
		v.CanCollide = false
		end
end

game:GetService("RunService").Stepped:Connect(function()
	ghost.PrimaryPart.CFrame = CFrame.new(HRP.CFrame * Vector3.new(1.5,3,0))
	ghost.PrimaryPart.Orientation = HRP.Orientation
end)

Edit: Sorry if this is the wrong section, first ever post.

1 Like

Ok, first of all you do not need the runservice event. You see when you set the primary part of a model the other parts aren’t automatically welded to the main part, this means you’ll have to weld them to the main part yourself (you don’t need to use a script for this). After just weld the mainpart to you, btw after welding remember to make all the parts in the model unanchored.

3 Likes