--LIGHTS BUTTONS


for _,i in pairs(lights:GetChildren()) do
	if i:IsA("ImageButton") and i.Name ~= "header" then
		if string.match(i.Name,"%l+") == "td" then
			i.MouseButton1Click:connect(function()
				script.Parent.lighty.Value = tonumber(string.match(i.Name,"%d"))
				if script.Parent.lighty.Value == 0 then
					lights.td0.Image = imgassets.sirenson
					lights.td1.Image = imgassets.hazardoff
					lights.td2.Image = imgassets.leftyoff
					lights.td3.Image = imgassets.rightyoff
					lights.td4.Image = imgassets.outoff
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.lighty.Value == 1 then
					lights.td0.Image = imgassets.sirensoff
					lights.td1.Image = imgassets.hazardon
					lights.td2.Image = imgassets.leftyoff
					lights.td3.Image = imgassets.rightyoff
					lights.td4.Image = imgassets.outoff
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.lighty.Value == 2 then
					lights.td0.Image = imgassets.sirensoff
					lights.td1.Image = imgassets.hazardoff
					lights.td2.Image = imgassets.leftyon
					lights.td3.Image = imgassets.rightyoff
					lights.td4.Image = imgassets.outoff
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.lighty.Value == 3 then
					lights.td0.Image = imgassets.sirensoff
					lights.td1.Image = imgassets.hazardoff
					lights.td2.Image = imgassets.leftyoff
					lights.td3.Image = imgassets.rightyon
					lights.td4.Image = imgassets.outoff
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.lighty.Value == 4 then
					lights.td0.Image = imgassets.sirensoff
					lights.td1.Image = imgassets.hazardoff
					lights.td2.Image = imgassets.leftyoff
					lights.td3.Image = imgassets.rightyoff
					lights.td4.Image = imgassets.outon
					seat.Parent.SSC.Beep:Play()						
				end
			end)
		elseif string.match(i.Name,"%l+") == "fl" then
			i.MouseButton1Click:connect(function()
				script.Parent.flasher.Value = tonumber(string.match(i.Name,"%d"))
				if script.Parent.flasher.Value == 0 then
					lights.fl0.Image = imgassets.sirenson
					lights.fl1.Image = imgassets.slowoff
					lights.fl2.Image = imgassets.fastoff
					lights.fl3.Image = imgassets.x2off
					lights.fl4.Image = imgassets.x4off
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.flasher.Value == 1 then
					lights.fl0.Image = imgassets.sirensoff
					lights.fl1.Image = imgassets.slowon
					lights.fl2.Image = imgassets.fastoff
					lights.fl3.Image = imgassets.x2off
					lights.fl4.Image = imgassets.x4off
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.flasher.Value == 2 then
					lights.fl0.Image = imgassets.sirensoff
					lights.fl1.Image = imgassets.slowoff
					lights.fl2.Image = imgassets.faston
					lights.fl3.Image = imgassets.x2off
					lights.fl4.Image = imgassets.x4off
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.flasher.Value == 3 then
					lights.fl0.Image = imgassets.sirensoff
					lights.fl1.Image = imgassets.slowoff
					lights.fl2.Image = imgassets.fastoff
					lights.fl3.Image = imgassets.x2on
					lights.fl4.Image = imgassets.x4off
					seat.Parent.SSC.Beep:Play()
				elseif script.Parent.flasher.Value == 4 then
					lights.fl0.Image = imgassets.sirensoff
					lights.fl1.Image = imgassets.slowoff
					lights.fl2.Image = imgassets.fastoff
					lights.fl3.Image = imgassets.x2off
					lights.fl4.Image = imgassets.x4on
					seat.Parent.SSC.Beep:Play()			
				end
			end)
		end
	end
end