How to have 3 seperate things with different waits inside 1 while loop

I am wanting to

  1. Check the clicks/second
  2. Auto click
  3. Fast auto click

All 3 of these require different waits, and should not impede on each other. Problem with current setup, is if you have FastAutoClick on, the while loop will only wait task.wait() and thus the clicks/second thing breaks and doesn’t actually calculate accurately. The other issue is the AutoClick now won’t run either. Players should be able to have both of them activated, and have them both run separately.

Please don’t suggest running in separate while loops. I feel having 3 separate while loops is bad for performance, and would like to keep it all managed inside 1. I imagine this can be achieved but just defaulting to task.wait() and have the 0.5 and the 1 second waits just check if its been 0.5 or 1 second

task.spawn(function()
		while true do
			--// TODO Need to adjust this for auto clickers
			if self.FastAutoClick then
				self:Clicked()
				
				task.wait()
			elseif self.AutoClick then
				self:Clicked()
				
				task.wait(0.5)
			else -- No auto clicker
				task.wait(1)
			end
			-- this code below should only run every second
			if self.Clicks == 0 then
				self.HUD.Left.Clicks.Container.Average.Visible = false
				
				continue
			end
			
			self.HUD.Left.Clicks.Container.Average.Text = "(" .. self.Clicks .. "/sec)"
			self.HUD.Left.Clicks.Container.Average.Visible = true
			
			self.Clicks = 0
		end
	end)