Making a game where you can spawn in noobs to fight other players but I don't want the noobs attacking its owners and I don't know how I can transfer information of a players character so I can make that possible
Here is the script in to noobs
wait(2)
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 99999999999999
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
--wait(math.random(0,5)/10)
while wait(0.1) do
script.Parent.Human.Died:Connect(function()
script.Parent:Destroy()
end)
if script.Parent.Human.Health == 0 then
script.Parent:Destroy()
end
local target = findNearestTorso(script.Parent. Torso.Position)
if target ~= nil then
script.Parent.Human:MoveTo(target.Position, target)
end
end

3 comments
There is a lot wrong with this...
no shit
Can't you do "If humanoid.Parent == owner then"