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

