local a,D={},{}local r=0 for s,Y in next,workspace.Critters:GetChildren()do r=r+1 if Y.PrimaryPart and(character and character.PrimaryPart)then local r=(character.PrimaryPart.Position-Y.PrimaryPart.Position).magnitude if r<ACTIVATE_AI_RANGE then table.insert(a,Y)else table.insert(D,Y)end end if r%10==0 then RS.Heartbeat:Wait()end end Rep.Relay.AI.AIUpdated:FireServer(a,D)elapsed=0

		local activate, deactivate = {}, {}
		local num = 0 
		for _,critter in next,workspace.Critters:GetChildren() do
			num = num + 1
			if critter.PrimaryPart and character and character.PrimaryPart then
				local distance = (character.PrimaryPart.Position - critter.PrimaryPart.Position).magnitude
				
				if distance < ACTIVATE_AI_RANGE then
					table.insert(activate, critter)
				else
					table.insert(deactivate, critter)
				end
			end
			
			if num % 10 == 0 then
				RS.Heartbeat:Wait()
			end
		end
		Rep.Relay.AI.AIUpdated:FireServer(activate, deactivate)
		elapsed = 0