When accessing a SSIS Variable in a Script Task, make sure you select the variables in either the readonlyvariables or readwritevariables area in the Script Tasks properties. If not they will not be passed through the Script Task.
To access a variable in the code (in my case c#.net), use the following
Variables.VARIABLENAME