--LIGHTING FUNCTIONS


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