I'm trying to convert this section into an Anti-TK one that works in FE. I'd like the script to not apply damage to teammates but to players that aren't in the same team. If anyone could help me make this work, I'd be glad.
Original section
while PierceAvailable >= 0 do
local Hit,EndPos = RayCast(Start,Direction,5000,Character)
if not Module.ExplosiveEnabled then
if Hit and Hit.Parent then
local TargetHumanoid = Hit.Parent:FindFirstChild("Humanoid")
local TargetTorso = Hit.Parent:FindFirstChild("Torso")
--local TargetTEAM = Hit.Parent:FindFirstChild("TEAM")
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then
InflictTarget:FireServer(TargetHumanoid,
TargetTorso,
(Hit.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
Direction,
Module.Knockback,
Module.Lifesteal,
Module.FlamingBullet)
PiercedHumanoid[TargetHumanoid] = true
--end
else
PierceAvailable = 0
end
end
Attempted edit
while PierceAvailable >= 0 do
local Hit,EndPos = RayCast(Start,Direction,5000,Character)
if not Module.ExplosiveEnabled then
if Hit and Hit.Parent then
local TargetHumanoid = Hit.Parent:FindFirstChild("Humanoid")
local TargetTorso = Hit.Parent:FindFirstChild("Torso")
--local TargetTEAM = Hit.Parent:FindFirstChild("TEAM")
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso and Player.TeamColor == "Bright red" then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then
elseif TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
InflictTarget:FireServer(TargetHumanoid,
TargetTorso,
(Hit.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
Direction,
Module.Knockback,
Module.Lifesteal,
Module.FlamingBullet)
PiercedHumanoid[TargetHumanoid] = true
--end
else
PierceAvailable = 0
end
end

1 comment
I love you.