Randomized strobe function

i’m not sure how to go about creating a randomized strobe for a stage lighting system that I’m developing.
i currently have it setup where its fixture group folder will have its own script (DMXControl) with values in side said script that the ui screens control to make the lights do things (i.e. controlling pan tilt lamp etc)

He is the code from DMXControl for toggling the lamp and Non funtional randomized strobe

local sr = 0
local sr2 = 0

for f,fixture in pairs (script.Parent:GetChildren())do 	
	if fixture:IsA("Model") then	
		fixturetype =fixture		
		

			
	
for i,WashSpotLamp in pairs (fixture.Housing.Lamps:GetChildren())do		
	task.wait(sr)			
			--for i,PixLamp in pairs (fixture.Housing.Lamps:GetChildren())do-- <--Controls Lamps Lenses and beams(Mainly for Pixel Mapable fixtures I.e. Tetra2,CP Beye)		
--------------------------------------------------------------
script.LampOn.Changed:connect(function()
------Variables----------------------------------------	
	local brightnessChange = .1 --Smoothness
	local timeChange = 0.01 --Fade Speed
	local currentcol = Color3.fromHSV(0, 0, 0) -- current colour(off)
	local desiredcol = Color3.fromHSV(0, 0, 1) --desired colour (On) --
----Lamp System-------------------------------------

if fixturetype:HasTag("Wash") or fixturetype:HasTag("Spot") then				
					
	if script.LampOn.Value == true  then				
		WashSpotLamp.SpotLight.Enabled = true	
		--Dimmer On-------------------------------------
		for count = 0,1,brightnessChange do			
		WashSpotLamp.SpotLight.Brightness = count
		WashSpotLamp.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.SpotLight.Color = currentcol:lerp(desiredcol, count)						 				
			task.wait(timeChange)
		end
	else  
		--Dimmer Off ------------------------------------
		for count = 1, 0, -brightnessChange do	
		WashSpotLamp.SpotLight.Brightness = count
		WashSpotLamp.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.SpotLight.Color = currentcol:lerp(desiredcol, count)						 				
		task.wait(timeChange)
		end
		WashSpotLamp.SpotLight.Enabled = false		
	end

elseif fixturetype:HasTag("SpotBeam")then			
if script.LampOn.Value == true  then				
		WashSpotLamp.Parent.Lens.SpotLight.Enabled = true
		WashSpotLamp.Parent.Lamp2.SpotLight2.Enabled = true	
	--Dimmer On-------------------------------------
	for count = 0,1,brightnessChange do			
		WashSpotLamp.Parent.Lens.SpotLight.Brightness = count					
		WashSpotLamp.Parent.Lamp2.SpotLight2.Brightness = count
		WashSpotLamp.Parent.Lens.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.Parent.Lens.SpotLight.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.Parent.Lamp2.SpotLight2.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.Parent.Lens.BeamLamp.Brightness = count
		WashSpotLamp.Parent.Lens.BeamLamp.Color = ColorSequence.new(currentcol:lerp(desiredcol, count))		
		task.wait(timeChange)
	end
else  
	--Dimmer Off ------------------------------------
	for count = 1, 0, -brightnessChange do	
	WashSpotLamp.Parent.Lens.SpotLight.Brightness = count					
	WashSpotLamp.Parent.Lamp2.SpotLight2.Brightness = count
	WashSpotLamp.Parent.Lens.Color = currentcol:lerp(desiredcol, count)
	WashSpotLamp.Parent.Lens.SpotLight.Color = currentcol:lerp(desiredcol, count)
	WashSpotLamp.Parent.Lamp2.SpotLight2.Color = currentcol:lerp(desiredcol, count)
	WashSpotLamp.Parent.Lens.BeamLamp.Brightness = count
	WashSpotLamp.Parent.Lens.BeamLamp.Color = ColorSequence.new(currentcol:lerp(desiredcol, count))		
		task.wait(timeChange)
	end
		WashSpotLamp.Parent.Lens.SpotLight.Enabled = false
		WashSpotLamp.Parent.Lamp2.SpotLight2.Enabled = false	
end
	elseif fixturetype:HasTag("PixBeam")then
	if script.LampOn.Value == true  then				
		WashSpotLamp.SpotLight.Enabled = true	
		--Dimmer On-------------------------------------
		for count = 0,1,brightnessChange do			
		WashSpotLamp.SpotLight.Brightness = count
		WashSpotLamp.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.SpotLight.Color = currentcol:lerp(desiredcol, count)
		WashSpotLamp.SpotLight.Beam.Brightness = count	
		WashSpotLamp.SpotLight.Beam1.Brightness = count	
		WashSpotLamp.SpotLight.Beam.Color = ColorSequence.new(currentcol:lerp(desiredcol, count))
		WashSpotLamp.SpotLight.Beam1.Color =  ColorSequence.new(currentcol:lerp(desiredcol, count))					 				
			task.wait(timeChange)
		end
	else  
		--Dimmer Off ------------------------------------
		for count = 1, 0, -brightnessChange do	
			WashSpotLamp.SpotLight.Brightness = count
			WashSpotLamp.Color = currentcol:lerp(desiredcol, count)
			WashSpotLamp.SpotLight.Color = currentcol:lerp(desiredcol, count)
			WashSpotLamp.SpotLight.Beam.Brightness = count	
			WashSpotLamp.SpotLight.Beam1.Brightness = count	
			WashSpotLamp.SpotLight.Beam.Color = ColorSequence.new(currentcol:lerp(desiredcol, count))
			WashSpotLamp.SpotLight.Beam1.Color =  ColorSequence.new(currentcol:lerp(desiredcol, count))
			task.wait(timeChange)
		end
		WashSpotLamp.SpotLight.Enabled = false		
	end					
	end
end)
			
----Colour Control-----------------------------------------
script.Colour.Changed:connect(function()
	--Variables----------------------------------------	
	local ColourChange = .1 --Smoothness
	local timeChange = 0.01 --Fade Speed
	local currentcol = WashSpotLamp.Color   -- current colour(last Colour)
	local Setcol = script.Colour.Value  --DMX colour Value (On) 
		---------------------------------------------------
		print("colchange")
				for i = 0, 1, ColourChange do
					if fixturetype:HasTag("Wash") or fixturetype:HasTag("Spot") then 			
						WashSpotLamp.SpotLight.Color =  currentcol:lerp(Setcol, i)
						WashSpotLamp.Color =  currentcol:lerp(Setcol, i)
					elseif fixturetype:HasTag("PixBeam")then
						WashSpotLamp.SpotLight.Color =  currentcol:lerp(Setcol, i)
						WashSpotLamp.Color =  currentcol:lerp(Setcol, i)
						WashSpotLamp.SpotLight.Beam.Color = ColorSequence.new(currentcol:lerp(Setcol, i))
						WashSpotLamp.SpotLight.Beam1.Color =  ColorSequence.new(currentcol:lerp(Setcol, i))						
					elseif fixturetype:HasTag("SpotBeam")then
						WashSpotLamp.Parent.Lens.SpotLight.Color =  currentcol:lerp(Setcol, i)
						WashSpotLamp.Parent.Lamp2.SpotLight2.Color =  currentcol:lerp(Setcol, i)
						WashSpotLamp.Parent.Lens.Color =  currentcol:lerp(Setcol, i)
						WashSpotLamp.Parent.Lens.BeamLamp.Color =  ColorSequence.new(currentcol:lerp(Setcol, i))
						--if fixture.Housing:FindFirstChild("Gobo")~= nil then continue end 					
						--fixture.Housing.Gobo.GBeam1.Color = ColorSequence.new(currentcol:lerp(Setcol, i))
						--fixture.Housing.Gobo.GBeam2.Color = ColorSequence.new(currentcol:lerp(Setcol, i))
						--fixture.Housing.Gobo.GBeam3.Color = ColorSequence.new(currentcol:lerp(Setcol, i))
						--fixture.Housing.Gobo.GBeam4.Color = ColorSequence.new(currentcol:lerp(Setcol, i))					
					end
		task.wait(timeChange)		
	end
end)

And non functional Randomized strobe

		script.Stroberand.Changed:connect(function()
			
			
	
			if script.Stroberand.Value == true then
				
				
			else 
				sr =0
				f = f
			end	
		while true do
			task.wait(.1)	
				if script.Stroberand.Value == true then
					sr = 0.1
					
					script.LampOn.Value = false
			task.wait(.1)	
					
					sr =0.001	
					script.LampOn.Value = true			
			end			
					
		end		

end)
Any help will be much appreciated!

(Edit: I have managed to get it working )