local L=script.Parent local w=script.Parent.Parent local F=0 L.OnServerEvent:connect(function(L,K)if K.ToggleLight then if w.Body.Light.on.Value==true then w.Body.Light.on.Value=false else w.Body.Light.on.Value=true end elseif K.EnableBrakes then w.Body.Brakes.on.Value=true elseif K.DisableBrakes then w.Body.Brakes.on.Value=false elseif K.ToggleLeftBlink then if w.Body.Left.on.Value==true then w.Body.Left.on.Value=false else w.Body.Left.on.Value=true end elseif K.ToggleRightBlink then if w.Body.Right.on.Value==true then w.Body.Right.on.Value=false else w.Body.Right.on.Value=true end elseif K.ReverseOn then w.Body.Reverse.on.Value=true elseif K.ReverseOff then w.Body.Reverse.on.Value=false elseif K.ToggleStandlicht then if F==0 then F=2 w.Body.Headlight.on.Value=true elseif F==1 then F=2 w.Body.Headlight.on.Value=true elseif F==2 then F=3 w.Body.Highlight.on.Value=true elseif F==3 then F=1 w.Body.Highlight.on.Value=false w.Body.Headlight.on.Value=false end elseif K.ToggleHazards then if w.Body.Hazards.on.Value==false then w.Body.Hazards.on.Value=true elseif w.Body.Hazards.on.Value==true then w.Body.Hazards.on.Value=false 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.Brakes.on.Value=true
	elseif data['DisableBrakes'] then
		car.Body.Brakes.on.Value=false
	elseif data['ToggleLeftBlink'] then
		if car.Body.Left.on.Value==true then
			car.Body.Left.on.Value=false
		else
			car.Body.Left.on.Value=true
		end
	elseif data['ToggleRightBlink'] then
		if car.Body.Right.on.Value==true then
			car.Body.Right.on.Value=false
		else
			car.Body.Right.on.Value=true
		end
	elseif data['ReverseOn'] then
		car.Body.Reverse.on.Value=true
	elseif data['ReverseOff'] then
		car.Body.Reverse.on.Value=false
	elseif data['ToggleStandlicht'] then
		if LichtNum == 0 then
			LichtNum = 2
			car.Body.Headlight.on.Value = true
		elseif LichtNum == 1 then
			LichtNum = 2
			car.Body.Headlight.on.Value = true
		elseif LichtNum == 2 then
			LichtNum = 3
			car.Body.Highlight.on.Value = true
		elseif LichtNum == 3 then
			LichtNum = 1
			car.Body.Highlight.on.Value = false
			car.Body.Headlight.on.Value = false
		end
	elseif data["ToggleHazards"] then
		if car.Body.Hazards.on.Value == false then
			car.Body.Hazards.on.Value = true	
		elseif car.Body.Hazards.on.Value == true then
			car.Body.Hazards.on.Value = false
		end
	end
end)
