Basically, I have a function that stops people from being able to team-kill. What I want to do, is add a certain team to a white list. Meaning, say you have a team named "Team1" on the Whitelist, anyone on Team1 will then be able to team-kill each other.
Code:
function Fire(ShootingHandle) local PierceAvailable = Module.Piercing PiercedHumanoid = {} if FireAnim then FireAnim:Play(nil,nil,Module.FireAnimationSpeed) end if not ShootingHandle.FireSound.Playing or not ShootingHandle.FireSound.Looped then ShootingHandle.FireSound:Play() end local Start = (Humanoid.Torso.CFrame * CFrame.new(0,1.5,0)).p--(Handle.CFrame * CFrame.new(Module.MuzzleOffset.X,Module.MuzzleOffset.Y,Module.MuzzleOffset.Z)).p local Spread = Module.Spread*(AimDown and 1-Module.SpreadRedution or 1) local Direction = (CFrame.new(Start,Mouse.Hit.p) * CFrame.Angles(math.rad(-Spread+(math.random()*(Spread*2))),math.rad(-Spread+(math.random()*(Spread*2))),0)).lookVector 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
For anyone wondering, I did end up fixing this myself. Basically I added a BoolValue to the teams that I wanted Whitelisted and set it to True for them and False for anyone else not on the whitelisted team. Then in the code I just added a check to the line:
if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then
Like so:
if TargetTEAM and TargetTEAM.Value ~= TEAM.Value or TargetFFA.Value == true then
Thanks to anyone that tried helping me!