Are you sure you’re sticking the block of code inside the .cpp file? In case you got the images mixed up from my above post, the top image is the .h file and the lower image is the .cpp file. I may be wrong about putting the “if” statement inside the default function that gets created with the .cpp, so if you copy what I have written in my images (obviously swapping AGameModeVikings out for whatever your game mode is called) there is no reason why it shouldn’t work. Other than that the steps that you’ve taken are correct.
If you still have issues after doing that then all I can suggest is creating a new project and doing the same thing there, just to make sure there isn’t something you’ve done wrong in your blueprints.
Hope this helps!