Solenoid valve with optocoupler and transistor

I know, but in my circuit i’m using the 12V of my PS on the transistor! I wanted to know if this would work just by replacing my TIP120 and adding the 10k resistor.