Welding and Unwelding Code

Hello there. I got 2 fire hoses, and I want them to weld on touch, and unweld on click. From now, I got a code, and I need someone to help me, cause I don’t really know how to continue it. I just want help with the full code.

1 Like

Here’s a lil something for ya

Use this to create a weld

local function weld()
	weld = Instance.new('Weld')
	weld.Parent = parentpart
	weld.Part0 = part1
	weld.Part1 = part2
end

weld()

The command to delete something is “:Destroy()”

2 Likes
local function weld(part1, part2, parent)
local Weld = Instance.new('Weld')
Weld.Part0 = part1
Weld.Part1 = part2
if parent ~= nil then
Weld.Parent = parent
else
Weld.Parent = part1
end
end



local function removeweld(part)
for _, v in pairs(part:GetChildren()) do
if v:IsA('Weld') then
v:Destroy()
end
end
end

weld(--, --, --)
wait(5)
removeweld(--)

“part1” has the value of Part0 and “part2” has the value of Part1. “parent” is where the weld is parented to.

“part” is the part the weld(s) should be cleared from.

2 Likes

Thanks for help, where do I place the script?

Depends on if you use a local or serverscript. I recommend you just put it where it runs. For example Localscript in StarterGui or Serverscript in ServerScriptService.

1 Like

yo, where do i name the 2 parts im welding in the script? i am really tired, please help me

weld(first part, second part, the parent of the part) sorry i was offline for a bit
removewelds(the part the weld should be removed from)