It is fine if I have just one but when I have more than one that is when it starts getting weird
they all go after each other and I'm not sure why
Also the first one doesn't move
local Bandit = script.Parent
local Humanoid = script.Parent.Humanoid
local Torso = nil
coolDown = false
animation = Bandit.Animation
Bandit.Torso.Touched:connect(function(Target)
if coolDown == false then
if Target.Parent.Humanoid then
coolDown = true
Target.Parent.Humanoid.Health = Target.Parent.Humanoid.Health - 7
wait(1)
coolDown = false
end
end
end)
while true do
for item, child in pairs(game.Workspace:GetChildren()) do
if child.ClassName == "Model" then
local Human = child:FindFirstChild("Humanoid")
if Human ~= nil then
if child.Name ~= "Mountain Bandit" then
if Torso ~= nil then
if (Bandit.Torso.Position - child.Torso.Position).magnitude < 30 then
Torso = child.Torso
end
end
end
if Torso == nil then
Torso = child.Torso
end
end
end
if Torso ~= nil then
Humanoid:MoveTo(Torso.Position, Torso)
end
end
wait(.1)
end
