Hi and thank you for your question.
Code 30 is the lean angle cut off switch but understand, it does not only mean the sensor has failed. It can also mean there is an open or short circuit. There is no reset on this circuit. Once the fault has been corrected, the code will no longer appear and the bike will start and run normally. If you are still getting the 30 code, it is because it is still detecting a problem. The system checks itself every time the key is turned on and only reports detected trouble codes.
If you aren't blowing any fuses, it would be reasonable to think that there is an open circuit problem. This could be anything from a broken wire going to the sensor to a terminal pushing out of a connector for that sensor circuit.
Just to cover the base, double check and make sure the lean angle cut off switch is mounted with the UP in the UP position. I am fairly confident that isn't news to you, but in the interest of being complete, I had to mention it.
If you replaced the lean angle sensor with a NEW one, and you are still getting code 30, you are going to have to scrutinize each wire that connects to the lean angle cut off switch and trace them all the way back until they get to the ECM. I mentioned what you are looking for, but those are only the common problems. Look for any sign of a problem on any of those wires. I would also add that tugging slightly on the wires every 4-6" or so will check to see if there is an internal break. If the wires inside the insulation have broken but the insulation has not. The broken wires will allow the insulation to stretch. If the wires were not broken, the insulation will not stretch.
Was the bike crashed or what caused the sensor to fail? Any additional information could prove beneficial to both of us so if there is more to the story, feel free to share.