-- Teknikk Sounder Core V1 --

local Status = script.Parent.Parent.Status
local Tone = script.Parent.Parent.SounderTone
local SounderSync = script.Parent.Parent.SounderSync
local Run = false
Status.Changed:connect(function()
	if Run then return end
	Run = true
	if Status.Value == 1 --ALARM
	or Status.Value == 12 --TEST
	then
	wait(1)
	if Tone.Value == 1 then -- CONTINIUS 
		SounderSync.Value = true
		Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
	end
	
	if Tone.Value == 2 then -- PULSE 	
		while true do
			wait(0.2)
			SounderSync.Value = true
			Status.Parent.Panel.Relay.Pitch = 3
			Status.Parent.Panel.Relay:Play()
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
			wait(0.2)			
			Status.Parent.Panel.Relay.Pitch = 2.5
			Status.Parent.Panel.Relay:Play()
			SounderSync.Value = false
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Sand red")
		end
	end

	if Tone.Value == 3 then -- CODE 3
		while true do
			for C3 = 1, 3 do
			wait(0.3)
			SounderSync.Value = true
			Status.Parent.Panel.Relay.Pitch = 3
			Status.Parent.Panel.Relay:Play()
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
			wait(0.6)
			SounderSync.Value = false
			Status.Parent.Panel.Relay.Pitch = 2.5
			Status.Parent.Panel.Relay:Play()
			Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Sand red")
			end
			wait(1.5)
		end
	end
	
	end
end)
SounderSync.Value = false
Status.Parent.Panel.Relay.Pitch = 2.5
Status.Parent.Panel.Relay:Play()
