I’ve got this free model gun system that is basically the RRP2 gun system but made FE. For some reason, if the user of the gun is on a team, the bullets won’t damage anything that isn’t another player. If they aren’t it will damage everything with a humanoid in it, including NPCs and other players. I see some code that suggest a primitive “anti team kill”, but I don’t think its working as intended. Help?
Relavant code:
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or hitPlayer then
TagHumanoid(hitHumanoid, MyPlayer)
script.Parent.DamageEvent:FireServer(hitHumanoid)
local target = MyMouse.Target
if target and target.Parent then
local player = PlayersService:GetPlayerFromCharacter(target.Parent)
if player then
if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
SetReticleColor(EnemyReticleColor)
else
SetReticleColor(FriendlyReticleColor)
end
end
end
end
Let me know if you need more of the code