i use an R15 morph to create my characters, but how would i rewrite this script so that instead of just welding single parts, it welds parts inside of a model too? (i already asked this question but i didnt get the answer i needed)
script:
function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Chest1") == nil then
local g = script.Parent.Parent.Chest1:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent.UpperTorso
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
if h[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
end
script.Parent.Touched:connect(onTouched)

6 comments
no
what was the point of that.
why
Use IsA("BasePart"). It will save you a lot of hassle and typing. "BasePart" has four descendants: Part, MeshPart, WedgePart and UnionOperation.
so it would be" if h[i] IsA("BasePart") then " ?
and plus how would i solve my problem? in the morph you have chest1, chest2, Hair, etc., the morph script welds the parts inside of these models, but how would i get the script to weld parts inside of a model inside of one of those models?