I'm making a Texas Hold 'Em style Poker game. I'm having difficulty with a function which is called from inside a loop, whose intended role is to make the cards to deal to the players. When I pass loopindex to the function as a parameter, and use that parameter to set an object's variable (one created in the function), it ends up being erroneous (-1).
Here's the loop and function from the event sheet with arrows pointing to the relevant bits --
And this is the debugger showing the created cards' unexpected cardNumber variable (the one derived from the loopindex) --