So I tried to make a script where it gives damage to a specific part of the body but it does not work correctly. Any help? ~Thanks.
beam.Touched:connect(function(hit)
local name = hit.Parent.Parent.Name
if not name then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if not humanoid then
humanoid = hit.Parent.Parent:FindFirstChild("Humanoid")
end
local limbs = hit.Parent:findFirstChild("Right Arm")
or hit.Parent:findFirstChild("Right Shoulder")
or hit.Parent:findFirstChild("Right Hip")
or hit.Parent:findFirstChild("Right leg")
or hit.Parent:findFirstChild("Left Hip")
or hit.Parent:findFirstChild("Left Leg")
or hit.Parent:findFirstChild("Left Arm")
or hit.Parent:findFirstChild("Left Shoulder")
local chest = hit.Parent:findFirstChild("Torso")
local head = hit.Parent:findFirstChild("Head")
if chest then
if humanoid then
humanoid:TakeDamage(props.chestDamage)
end
end
if head then
if humanoid then
humanoid:TakeDamage(props.headDamage)
end
end
if limbs then
if humanoid then
humanoid:TakeDamage(props.limbDamage)
end
end
end
end)

2 comments
It still does not work
Also, findFirstChild is a deprecated version of FindFirstChild. They do the exact same thing.