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