Welds not working

  1. What do you want to achieve?
    Weld parts together using a script.

  2. What is the issue?
    The welds don’t work. I believe their property “Active” should be set to true, but it’s not.

  3. What solutions have you tried so far?
    I’ve searched many posts but none of them seemed to fix my problem and all of them were using code just like I am using. Perhaps the problem could be that I’m “exporting” those parts from a ViewPort Frame to workspace?

Here’s my code:

function weld(p0, p1)
	local w = Instance.new("Weld")
	w.Parent = p0
	w.Part0 = p0
	w.Part1 = p1
	w.C1 = (p0.CFrame+p0.PositionAttachment.CFrame.Position)*p1.CFrame
	return w
end

Use weldconstraint they’re much easier to use.

1 Like

Thanks for the reply! It worked. Could you please explain to me the difference between Weld and WeldConstraint?

1 Like

https://developer.roblox.com/en-us/api-reference/class/Weld
https://developer.roblox.com/en-us/api-reference/class/WeldConstraint

The only major difference is that Weld has been removed from “Insert Object” and WeldConstraint was added somewhat recently.

Weld has been superceded by WeldConstraint

1 Like