local E=script.Parent local Z=script.Parent.Parent local w=0 E.OnServerEvent:connect(function(E,c)if c.ToggleLight then if Z.Body.Light.on.Value==true then Z.Body.Light.on.Value=false else Z.Body.Light.on.Value=true end elseif c.EnableBrakes then Z.Body.Lights.Brake.Value=true elseif c.DisableBrakes then Z.Body.Lights.Brake.Value=false elseif c.ToggleLeftBlink then if Z.Body.Lights.Left.Value==true then Z.Body.Lights.Left.Value=false else Z.Body.Lights.Left.Value=true Z.Body.Lights.Right.Value=false end elseif c.ToggleRightBlink then if Z.Body.Lights.Right.Value==true then Z.Body.Lights.Right.Value=false else Z.Body.Lights.Right.Value=true Z.Body.Lights.Left.Value=false end elseif c.ReverseOn then Z.Body.Lights.Reverse.Value=true elseif c.ReverseOff then Z.Body.Lights.Reverse.Value=false elseif c.ToggleStandlicht then if w==0 then w=2 Z.Body.Lights.Headlights.Value=true elseif w==1 then w=2 Z.Body.Lights.Headlights.Value=true elseif w==2 then w=3 Z.Body.Lights.HiBeams.Value=true elseif w==3 then w=1 Z.Body.Lights.Headlights.Value=false Z.Body.Lights.HiBeams.Value=false end elseif c.ToggleHazards then if Z.Body.Lights.Hazards==false then Z.Body.Lights.Right.Value=false Z.Body.Lights.Left.Value=false elseif Z.Body.Lights.Hazards==true then Z.Body.Lights.Right.Value=true Z.Body.Lights.Left.Value=true end end end)


local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0


event.OnServerEvent:connect(function(player,data)
	if data['ToggleLight'] then
		if car.Body.Light.on.Value==true then
			car.Body.Light.on.Value=false
		else
			car.Body.Light.on.Value=true
		end
	elseif data['EnableBrakes'] then
		car.Body.Lights.Brake.Value=true
	elseif data['DisableBrakes'] then
		car.Body.Lights.Brake.Value=false
	elseif data['ToggleLeftBlink'] then
		if car.Body.Lights.Left.Value==true then
			car.Body.Lights.Left.Value=false
		else
			car.Body.Lights.Left.Value=true
			car.Body.Lights.Right.Value=false
		end
	elseif data['ToggleRightBlink'] then
		if car.Body.Lights.Right.Value==true then
			car.Body.Lights.Right.Value=false
		else
			car.Body.Lights.Right.Value=true
			car.Body.Lights.Left.Value=false
		end
	elseif data['ReverseOn'] then
		car.Body.Lights.Reverse.Value=true
	elseif data['ReverseOff'] then
		car.Body.Lights.Reverse.Value=false
	elseif data['ToggleStandlicht'] then
		if LichtNum == 0 then
			LichtNum = 2
			car.Body.Lights.Headlights.Value = true
		elseif LichtNum == 1 then
			LichtNum = 2
			car.Body.Lights.Headlights.Value = true
		elseif LichtNum == 2 then
			LichtNum = 3
			car.Body.Lights.HiBeams.Value = true
		elseif LichtNum == 3 then
			LichtNum = 1
			car.Body.Lights.Headlights.Value = false
			car.Body.Lights.HiBeams.Value = false
		end
	elseif data["ToggleHazards"] then
		if car.Body.Lights.Hazards == false then
			car.Body.Lights.Right.Value=false
			car.Body.Lights.Left.Value=false	
		elseif car.Body.Lights.Hazards == true then
			car.Body.Lights.Right.Value=true
			car.Body.Lights.Left.Value=true
		end
	end
end)
