Well for a start you again failed to show us the code that doesnt work, making it all that much more dificult to diagnose what yyou have done wrong.
However i worked out from your statment what it is.
please see
/help $input
specificly
Note: This identifier cannot be used in a script event. One way around this is to use a /timer to initiate an input request after the script ends.