--> FUNCTIONS

function Switch(V1, V2, V3, V4)
	if Mode.Value ~= V1 then
		Mode.Value = V1
		OnBtn.Transparency = V2
		OffBtn.Transparency = V3
		V4.Beep:Play()
	end
end

function Smoke(Enable)
	Module.Smoke1.ParticleEmitter.Enabled = Enable
	Module.Smoke2.ParticleEmitter.Enabled = Enable
end

OnBtn.ClickDetector.MouseClick:Connect(function()
	Switch(true, 0, .5, OnBtn)
	-- DO YOUR OWN ADDITIONAL CODE WHEN SWITCHED ON
end)

OffBtn.ClickDetector.MouseClick:Connect(function()
	Switch(false, .5, 0, OffBtn)
	Cylinder.Generator:Stop()
	-- DO YOUR OWN ADDITIONAL CODE WHEN SWITCHED OFF
end)

script.On:GetPropertyChangedSignal("Value"):Connect(function()
	if Mode.Value == true then
		Smoke(true)
		Cylinder.Generator:Play()
		while Mode.Value == true do
			OGPosition = Cylinder.Position
			Goal = {}
			Goal.Position = OGPosition + Vector3.new(0, .5, 0)
			TweenService:Create(Cylinder, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), Goal):Play()
			wait(.5)
			Goal.Position = OGPosition
			TweenService:Create(Cylinder, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In), Goal):Play()
			wait(.5)
		end
		Smoke(false)
	end
end)
