Weld Constraints not working with CFrame?

I kind of messed up in my last post which will be linked, but I’m re-writing it to make things clearer.

I want to CFrame a model to make it look as if it is following my character without using SetPrimaryPartCFrame() as it slowly rips the model apart. I tried using Weld Constraints to do this by Welding each part of the model to the Primary Part of the model and then loop CFraming the Primary Part to where I wanted it to be (next to my characters head/above its shoulder.) The Weld Constraints did not hold the model together when anchored and only the Primary Part of the model was moved to where I wanted it. But when I unanchored the parts, the entire thing fell apart.

Here is the code I am trying to use (I also messed this up slightly in my last post, so here is the updated version)

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.PrimaryPart
		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 * Vector3.new(0,math.rad(-90),0)
end)

You need to unanchor every part welded to the PrimaryPart while keeping the PrimaryPart welded.

3 Likes

Maybe you’re looking to have all the parts connect. V:IsA(“BasePart”) is what you want to use to check it is a part. Also I remember hearing something about moving cframes messing with weld constraints.

Thanks, yeah I just realised that I unanchored the Primary Part too LOL. Just added a wait and reanchored it before moving anything.