bin=script.Parent function move(I)local A=(I.Position-bin.Position).unit local e=bin.Position local X=e+A*1;(bin:findFirstChild("\066\111\100\121\071\121\114\111")).cframe=CFrame.new(X,X+A);(bin:findFirstChild("\066\111\100\121\071\121\114\111")).maxTorque=Vector3.new(9000,9000,9000)end function moveTo(I)bin.BodyPosition.position=I.Position bin.BodyPosition.maxForce=Vector3.new(10000,10000,10000)*bin.Speed.Value end function findNearestTorso(I)local A=game.Workspace:GetChildren()local e=nil local X=1000 local a=nil local S=nil local J=nil for W=1,#A,1 do J=A[W]if J.className=="\077\111\100\101\108"and J~=script.Parent then a=J:findFirstChild("\084\111\114\115\111")S=J:findFirstChild("\072\117\109\097\110\111\105\100")if a~=nil and(S~=nil and S.Health>0)then if(a.Position-I).magnitude<X then e=a X=(a.Position-I).magnitude end end end end return e end function shoot(I)dir=(I-bin.CFrame.p).unit for I=1,50,1 do local A=Instance.new("\069\120\112\108\111\115\105\111\110")A.BlastRadius=1 A.Position=(bin.Position+(dir*10)*I)+dir*7 A.Parent=game.Workspace end end function shootAt(I)local A=(I.Position-bin.Position).unit local e=bin.Position local X=e+A*1 shoot(X)end while true do local I=findNearestTorso(bin.Position)if I~=nil then move(I)moveTo(I)end wait()end
bin = script.Parent

function move(target)
	local dir = (target.Position - bin.Position).unit
	local spawnPos = bin.Position
	local pos = spawnPos + (dir * 1)
	bin:findFirstChild("BodyGyro").cframe = CFrame.new(pos,  pos + dir)
	bin:findFirstChild("BodyGyro").maxTorque = Vector3.new(9000,9000,9000)
end

function moveTo(target)
	bin.BodyPosition.position = target.Position
	bin.BodyPosition.maxForce = Vector3.new(10000,10000,10000) * bin.Speed.Value
end

function findNearestTorso(pos)
	local list = game.Workspace:GetChildren() -- WRONG!!!!
	local torso = nil
	local dist = 1000
	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

function shoot(pos)
	dir = (pos - bin.CFrame.p).unit 
	for i = 1, 50 do 
		local ex = Instance.new("Explosion") 
		ex.BlastRadius = 1
		ex.Position = bin.Position + (dir * 10 * i) + (dir * 7) 
		ex.Parent = game.Workspace 
	end
end

function shootAt(torso)
	local dir = (torso.Position - bin.Position).unit
	local spawnPos = bin.Position
	local pos = spawnPos + (dir * 1)
	shoot(pos)
end

while true do
	local torso = findNearestTorso(bin.Position)
	if torso~=nil then
		move(torso)
		moveTo(torso)
	end
	wait()
end
