Dismemberment visuals will only activate if the head was affected

I have a script that upon a value reaching 0, it will dismember a limb. It seems that it only activated upon head dismemberment. It should go to “else” and then repeat until it lands on the correct limb name. Here is the script:

for i, child in ipairs(script.Parent:GetDescendants()) do
	if child.Name == "LimbJointHP" or child.Name == "LimbPhysicalHP" then
		child:GetPropertyChangedSignal("Value"):Connect(function()
			if child.Value == 0 then
				if child.Parent.Name == "Head" then
					local Weld = Instance.new("Weld", script.Parent.Torso)
					Weld.Name = "GoreWeld"
					
					local HGoreTorso = game.ReplicatedStorage.TorsoGores.HeadGoreTorso:Clone()
					HGoreTorso.Parent = script.Parent.Torso
					HGoreTorso.CFrame = script.Parent.Torso.CFrame
					Weld.Part0 = script.Parent.Torso
					Weld.Part1 = HGoreTorso
				else
					if child.Name == "Left Arm" then
						local Weld = Instance.new("WeldConstraint", script.Parent.Torso)
						Weld.Name = "GoreWeld"

						local LAGoreTorso = game.ReplicatedStorage.TorsoGores.LArmGoreTorso:Clone()
						LAGoreTorso.Parent = script.Parent.Torso
						LAGoreTorso.CFrame = script.Parent.Torso.CFrame
						Weld.Part0 = script.Parent.Torso
						Weld.Part1 = LAGoreTorso
					else
						if child.Name == "Right Arm" then
							local Weld = Instance.new("WeldConstraint", script.Parent.Torso)
							Weld.Name = "GoreWeld"

							local RAGoreTorso = game.ReplicatedStorage.TorsoGores.RArmGoreTorso:Clone()
							RAGoreTorso.Parent = script.Parent.Torso
							RAGoreTorso.CFrame = script.Parent.Torso.CFrame
							Weld.Part0 = script.Parent.Torso
							Weld.Part1 = RAGoreTorso
						else
							if child.Name == "Left Leg" then
								local Weld = Instance.new("WeldConstraint", script.Parent.Torso)
								Weld.Name = "GoreWeld"

								local LLGoreTorso = game.ReplicatedStorage.TorsoGores.LLegGoreTorso:Clone()
								LLGoreTorso.Parent = script.Parent.Torso
								LLGoreTorso.CFrame = script.Parent.Torso.CFrame
								Weld.Part0 = script.Parent.Torso
								Weld.Part1 = LLGoreTorso
							else
								if child.Name == "Right Leg" then
									local Weld = Instance.new("WeldConstraint", script.Parent.Torso)
									Weld.Name = "GoreWeld"

									local RLGoreTorso = game.ReplicatedStorage.TorsoGores.RLegGoreTorso:Clone()
									RLGoreTorso.Parent = script.Parent.Torso
									RLGoreTorso.CFrame = script.Parent.Torso.CFrame
									Weld.Part0 = script.Parent.Torso
									Weld.Part1 = RLGoreTorso
								end
							end
						end
					end
				end
			else

			end
		end)
	end
end

should the other if statements be checking child.Parent.Name? they’re checking child.Name

also, this will be cleaner if you use elseif instead of else blocks with if blocks inside

if A then
   --
elseif B then
  --
end
1 Like

Yep, you’re right. I have missing the “Parent” lol.