Function that can store/accumulate a variable?

yes the variable is added to every time the function is called

I have a function that requires a global variable to accumulate a value, works fine as is, but with one variable for accumulation I cant play the function more than once at a time. I need a solution that can use the function multiple times

What exactly do you mean by “accumulation”? Is this variable a total that you are adding to by calling this function?

Store global Variables in your GameMode.

If you want to have a list of something like Integers you can use Arrays, or Dictionaries with text keys to look up the variable to accumulate.