The title explains my problem.
if string.find(script.Parent.Name, "Blue") then
EnemyTeam = "Red"
else
EnemyTeam = "Blue"
end
function findTarget()
for _, v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Model") and string.find(v.Name, EnemyTeam) and v:FindFirstChild("Humanoid") and v ~= script.Parent and v.Humanoid.Health > 0 and not game.Players:GetPlayerFromCharacter(v.Parent) then
script.Parent.Humanoid:MoveTo(v.Torso.Position)
end
end
end
while true do
wait(.2)
findTarget()
end

1 comment
Thanks!