local function findTarget()
local target
if script.parent.Equipped == true then
for i, v in pairs(players) do
if (v.Character.HumanoidRootPart.Positon - player.Chracter.HumanoidRootPart.Positon).magnitude < 50 then
if v.Team ~= player.Team then
if v > 1 then
return v
end
end
end
end
end
I'm trying to make this return the player who is the target, however the issue is if there is more than one player that fits these descriptions it will return both, is there a way I can return a random player that fits both the magnitude requirement and the team requirement?

1 comment
Use a break