NNickey

Untitled

Jun 15th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.95 KB | None | 0 0
  1. wait(0.5)local p=script.Parent local l=script.Swarm.Value local d=script.Damage.Value local e=script.Walk.Value local c=script.Attack.Value local b=script.Distance.Value local g=script.Commander.Value local k local i=true local f local o local a=false local a local m=false local n="roam"p.Humanoid.Died:connect(function()p:Destroy()end)function j(b,a)local c=p.Humanoid local g=p.Torso local f=20 local a=0 local a=true local e=1 local function d(a)c:MoveTo(a)if math.abs(p.Torso.Position.Y-b.Y)>7 then p.Humanoid.Jump=true end end local function a()if math.abs(g.Velocity.X)<e and math.abs(g.Velocity.Z)<e and not(l and o and(o.Position-g.Position).magnitude<5)then local b={g.CFrame*CFrame.new(f,0,-f),g.CFrame*CFrame.new(-f,0,-f),g.CFrame*CFrame.new(f,0,0),g.CFrame*CFrame.new(-f,0,0),g.CFrame*CFrame.new(f,0,f),g.CFrame*CFrame.new(-f,0,f),g.CFrame*CFrame.new(0,0,f)}local b=b[math.random(1,#b)]d(b.p)c.Jump=true local c=0 repeat wait(0.1)c=c+0.1 until c>=0.5 or(math.abs(g.Velocity.X)<e and math.abs(g.Velocity.Z)<e)or(b.p-g.Position).magnitude<3 or(l and o and(o.Position-g.Position).magnitude<5)a()end end d(b)wait()a()d(b)end function h()local c for a,a in pairs(game:service('Players'):GetPlayers())do if l and a.Character:FindFirstChild("Torso")and a.Character:FindFirstChild("Humanoid")and not a.Character:FindFirstChild("ForceField")and a.Character.Humanoid.Health<math.huge and a:DistanceFromCharacter(p.Torso.Position)<tonumber(b)then if not c then c=a elseif a:DistanceFromCharacter(p.Torso.Position)<c:DistanceFromCharacter(p.Torso.Position)then c=a end end end if not c or not c.Character:FindFirstChild("Torso")or not c.Character:FindFirstChild("Humanoid")then return nil end return c end f=p.Torso.Touched:connect(function(a)if c and i and p and a.Parent:FindFirstChild('Humanoid')and a.Parent:FindFirstChild('Torso')and a.Parent.Name~=p.Name then if a.Parent.Humanoid.Health>=math.huge or a.Parent:FindFirstChild('ForceField')then return end a.Parent.Humanoid.Health=a.Parent.Humanoid.Health-d end end)if#g>0 then k=game:service("Players"):FindFirstChild(g)if k then k.Chatted:connect(function(a)if a:lower():match("!bot")then local b=a:lower():match("!bot (.*)")if not b then return end if b:lower()=="stop"then m=true n="stop"elseif b:lower()=="roam"then m=true n="roam"elseif b:lower()=="follow"then m=true n="follow"elseif b:lower()=="attack"then local b=a:match("!bot attack (.*)")if b=="all"then m=true n="attackAll"else for a,a in pairs(game:service("Players"):children())do if a.Name:lower():sub(1,#b)==b:lower()and a.Character:FindFirstChild("Torso")then m=true o=a.Character.Torso end end end elseif b:lower()=="abort"then m=false end end end)end end repeat if m then o=nil if p.Humanoid.Sit then p.Humanoid.Jump=true p.Humanoid.Sit=false end wait()if n=="roam"then local a=Vector3.new(math.random(p.Torso.Position.X-50,p.Torso.Position.X+50),p.Torso.Position.Y,math.random(p.Torso.Position.Z-50,p.Torso.Position.Z+50))local b=0 repeat b=b+0.1 wait(0.1)j(a)until b>=1 or n~="roam"or not m wait()elseif n=="attackAll"then local a=h()if a then o=a.Character.Torso else o=nil end wait()elseif n=="stop"then wait(0.5)elseif n=="follow"then if k then local a=k.Character:FindFirstChild("Torso")if a then local b=0 repeat b=b+0.1 wait(0.1)j(a.Position)until b>=1 or n~="follow"or not m end end end if o then wait()j(o.Position,true)end else if not e then return end if p.Humanoid.Sit then p.Humanoid.Jump=true p.Humanoid.Sit=false end if o then wait()j(o.Position,true)else local a=Vector3.new(math.random(p.Torso.Position.X-50,p.Torso.Position.X+50),p.Torso.Position.Y,math.random(p.Torso.Position.Z-50,p.Torso.Position.Z+50))local b=0 repeat b=b+0.1 wait(0.1)j(a)until b>=1 or(l and h())end if l then local a=h()if a then o=a.Character.Torso else o=nil end else o=nil end wait()end until not p or not p.Humanoid or p.Humanoid.Health<=0 or not i repeat wait()until not p or not p.Humanoid or p.Humanoid.Health<=0 or not i i=false pcall(function()f:disconnect()end)wait(2)pcall(function()if p then p:Destroy()end end)
Advertisement
Add Comment
Please, Sign In to add comment