Hey, I want to weld all the parts in my tool.
I made an if statement so that only certain parts can get welded but for some reason the scripts is trying to get welded
I’ve tried excluding the script with an if statement but it still doesn’t work
This the tool
This is the error code
This is the welding Script:
local tool = script.Parent
local parts = tool:GetChildren()
local previous
for i = 1, #parts do
if parts[i].className == "Part" or parts[i].className == "WedgePart" or parts[i].className == "UnionOperation" then
if previous ~= nil then
print(parts[i])
local w = Instance.new("WeldConstraint")
w.Part0 = previous
w.Part1 = parts[i]
w.Parent = previous
end
end
previous = parts[i]
end
I’m not sure what to do