All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The liquid that comes out when thinking about lust or seeing what provokes it and is transparent and sticky is called Mathy, and it is impure. Its ruling is the ruling of urine, it is obligatory to perform Istinjaa’ from it and purify the clothes that are stained by it, but it is not obligatory to perform Ghusl from it.
As regards masturbation, it is forbidden, so you must repent to Allah from it.
For more benefit on the prohibition of masturbation, please refer to Fataawa 179859, 376036, 87952 and 81167.
For more benefit on Wady discharges and the difference between semen, Mathy, and Wady, please refer to Fataawa 82518, 300880 and 292780.
Allah Knows best.