Hey there. So, in this game I'm currently developing, I have these enemy NPCs that you must attack. Right now, I've just added swords to the enemies, but they seem to cause damage to each other when the sword goes near them. This is the one part of the code from the LinkedSwords I've edited from them.
--Beginning sword code here
function blow(hit)
if (hit.Parent == nil) and (hit.Parent == "Blooborn") then return end -- happens when bullet hits sword
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
--The rest of the sword code here
I'm not sure if I edited it correctly, so, my question is: How would I fix this part of the code? Cause I don't think Flow Control would have a key part in this..

2 comments
In his defense, all you'd really have to do is just change "NPC" to the name of your NPC's model. But, I do like how your method is way more simpler.
Makes sense.