local X=script.Parent local G=script.Parent.Parent local E=0 X.OnServerEvent:connect(function(X,m)if m.ToggleLight then if G.Body.Light.on.Value==true then G.Body.Light.on.Value=false else G.Body.Light.on.Value=true end elseif m.EnableBrakes then G.Body.Brakes.on.Value=true elseif m.DisableBrakes then G.Body.Brakes.on.Value=false elseif m.ToggleLeftBlink then if G.Body.Left.on.Value==true or G.Body.Right.on.Value==true then G.Body.Left.on.Value=false G.Body.Right.on.Value=false else G.Body.Left.on.Value=true end elseif m.ToggleRightBlink then if G.Body.Right.on.Value==true or G.Body.Left.on.Value==true then G.Body.Right.on.Value=false G.Body.Left.on.Value=false else G.Body.Right.on.Value=true end elseif m.ReverseOn then G.Body.Reverse.on.Value=true elseif m.ReverseOff then G.Body.Reverse.on.Value=false elseif m.ToggleStandlicht then if E==0 then E=1 G.Body.Headlight.on.Value=true elseif E==1 then E=0 G.Body.Headlight.on.Value=false end elseif m.ToggleHazards then if G.Body.Left.on.Value==true or G.Body.Right.on.Value==true then G.Body.Left.on.Value=false G.Body.Right.on.Value=false else G.Body.Left.on.Value=true G.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 = 0
			car.Body.Headlight.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)
