script.Parent.OnServerEvent:connect(function(C,s)if lt~=1 then pr=true else pr=false end lt=s if s==0 then UpdateLt(1,white)UpdatePt(false,white)StopMt(pr)elseif s==1 or s==2 then RefMt.DesiredAngle=RefMt.CurrentAngle%math.rad(360)RefMt.CurrentAngle=RefMt.CurrentAngle%math.rad(360)UpdateLt(.25,red)UpdatePt(true,red)UpdateMt(0,math.rad(225),4)wait(.75)repeat UpdateMt(0,math.rad(135),0)wait(.5)if lt~=1 and lt~=2 then break end UpdateMt(0,math.rad(225),0)wait(.5)until lt~=1 and lt~=2 elseif s==3 then wait(.5)UpdateLt(.25,red)UpdatePt(true,red)UpdateMt(0,9000000000.0,1)end end)
--LIGHTING FUNCTIONS

script.Parent.OnServerEvent:connect(function(pl, n)
	if lt ~= 1 then
		pr = true
	else
		pr = false
	end
	lt = n
	if n == 0 then
		UpdateLt(1, white)
		UpdatePt(false, white)
		StopMt(pr)
	elseif n == 1 or n == 2 then
		RefMt.DesiredAngle = RefMt.CurrentAngle % math.rad(360)
		RefMt.CurrentAngle = RefMt.CurrentAngle % math.rad(360)
		UpdateLt(0.25, red)
		UpdatePt(true, red)
		UpdateMt(0, math.rad(225), 4)
		wait(0.75)
		repeat
			UpdateMt(0, math.rad(135), 0)
			wait(0.5)
			if lt ~= 1 and lt ~= 2 then
				break
			end
			UpdateMt(0, math.rad(225), 0)
			wait(0.5)
		until lt ~= 1 and lt ~= 2
	elseif n == 3 then
		wait(0.5)
		UpdateLt(0.25, red)
		UpdatePt(true, red)
		UpdateMt(0, 9e9, 1)
	end
end)
