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