local y={}local J=tick()local K,l local d=tick()local C=15 local E=10 local c=nil for J,K in next,animations do y[K.Name]=hum:LoadAnimation(K)end function Attack(l,d)if tick()-J>2 then hum:MoveTo(root.Position)J=tick()y.AntWalk:Stop()y.AntMelee:Play()if l.ClassName=="\080\108\097\121\101\114"then root.FleshHit:Play()ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(K.Character.PrimaryPart.Position.X,root.Position.Y,K.Character.PrimaryPart.Position.Z)))elseif l.ClassName=="\077\111\100\101\108"then root.StructureHit:Play()end Rep.Relay.NPCAttack:Fire(l,d)end end function Move(J)hum:MoveTo(J)if not y.AntWalk.IsPlaying then y.AntWalk:Play()end end function ScanForPoint()local y local J=Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)local K=Ray.new(root.Position,J*math.random(10,50),ant)local l,d=workspace:FindPartOnRay(K)Move(d)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 = 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.Relay.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
