Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I welded my Items but when moved it falls APART!?

I welded all my Items with simple script

for i,v in pairs(script.Parent:GetChildren()) do
	if v:IsA("BasePart") or v:IsA("UnionOperation") then
		
		local handle = script.Parent:WaitForChild("Handle")
		local weild = Instance.new("Weld",v)
	 weild.Part0 = v
	weild.Part1 = handle
	weild.C0 = v.CFrame:inverse()
	weild.C1 = handle.CFrame:inverse()
	end
end

but when I equip my weapon and use the "zyx" moving tool to move the handle and it Falls right Apart!!!!!!! why is this happening!? is there a way to prevent it from happening and make it stick to the part

2 comments

0

just so you know when its equiped its welded and in place

0

Try removing the .CFrame:inverse()

1 answer

✓ Accepted answer
function Weld(p1, p2)
    local w = Instance.new("Weld", game.JointsService)
    w.C1 = p1.CFrame:toObjectSpace(p2.CFrame)
    w.Part0 = p2  
    w.Part1 = p1
end

Weld(0,0) -- The zeroes represent the two parts you want to weld

This discussion is preserved as it was. New answers, comments, and votes are closed.