You don't need to return anything from your Function (as it is above), because you have set Winner to be a Global variable, which is visible to the entire program regardless of whether it's in a Function or not. Take out the 'Return Winner' line from your Function.
On the other hand, if you need the Function to return Winner, you should assign the output from LogicModule to your Winner variable, as follows:
Having said all that, the code posted above should work, so you may have made a mistake elsewhere that causes the value of Winner to get changed.
On the other hand, if you need the Function to return Winner, you should assign the output from LogicModule to your Winner variable, as follows:
' Main Global Ply1:Int=0 Global Ply2:Int=0 Global Winner:Int Ply1=0 Ply2=1 Winner=LogicModule() Print Winner WaitKey End Function LogicModule() Winner=0 If Ply1=0 And Ply2=1 Then Winner=1 Return Winner EndFunction
Having said all that, the code posted above should work, so you may have made a mistake elsewhere that causes the value of Winner to get changed.