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

local anims = {}
local lastAttack = tick()

local target, targetType

local lastLock = tick()

local fleshDamage = 25
local structureDamage = 15

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
