I was doing this, and noticed that when packaging my game as a “shipping game” the console was removed and this code of course no longer worked.
You will want to move this to C++ eventually, or maybe epic will provide a “none console command” way of doing these types of things.