I have this script inside of a part because I want this part to destroy welds of other parts in models in workspace when it comes into contact with them, however it’s not working.
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if humanoid ~= nil then
return
else
local all = hit:FindFirstChildOfClass(“Weld”) or hit.Parent:FindFirstChildOfClass(“Weld”)
repeat
all = hit:FindFirstChildOfClass(“Weld”) or hit.Parent:FindFirstChildOfClass(“Weld”)
if all then
all:Destroy()
end
until all == nil
end
end)