local G={}local r=tick()local t,q local y=tick()local f=15 local k=10 local z=nil for r,t in next,animations do G[t.Name]=hum:LoadAnimation(t)end function Attack(q,y)if tick()-r>2 then hum:MoveTo(root.Position)r=tick()G.AntWalk:Stop()G.AntMelee:Play()if q.ClassName=="\080\108\097\121\101\114"then root.FleshHit:Play()ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(t.Character.PrimaryPart.Position.X,root.Position.Y,t.Character.PrimaryPart.Position.Z)))elseif q.ClassName=="\077\111\100\101\108"then root.StructureHit:Play()end rep.Events.NPCAttack:Fire(q,y)end end function Move(r)hum:MoveTo(r)if not G.AntWalk.IsPlaying then G.AntWalk:Play()end end function ScanForPoint()local G local r=Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)local t=Ray.new(root.Position,r*math.random(10,50),ant)local q,y=workspace:FindPartOnRay(t)Move(y)enRoute=true end


local anims = {}
local lastAttack= tick()

local target,targetType

local lastLock = tick()

local fleshDamage = 15
local structureDamage = 10

local path = nil


for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end

function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()

if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))

elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end

rep.Events.NPCAttack:Fire(thing,dmg) 
end
end


function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end

function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end