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


local anims = {}
local lastAttack= tick()

local target,targetType

local lastLock = tick()

local fleshDamage = 25
local structureDamage = 20

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