Hello!
Recently, I ran into a problem with the AI, where the bot would shoot me even when I was on the same team as it. There is a dedicated allies variable but doesn’t seem to work anymore. If anyone has a fix for this, please help!
local allies = {game.Teams.British}
local potentialTargets = {game.Teams.Natives}
function findTarget()
local dist = 200
local target = nil
potentialTargets = {}
local seeTargets = {}
for _,v in ipairs(workspace:GetChildren()) do
local human = v:FindFirstChild("Humanoid")
local torso = v:FindFirstChild("Torso") or v:FindFirstChild("HumanoidRootPart")
if human and torso and v.Name ~= script.Parent.Name then
if (myTorso.Position - torso.Position).magnitude < dist and human.Health > 0 then
for i,x in ipairs(allies) do
if x == v.Name then
break
elseif i == #allies then
table.insert(potentialTargets,torso)
end
end
end
end
end
If you need anymore of the script, please let me know, and ill send screenshots!