GameState Casting Issue

I was told to try and use GameState for this goal I am trying to accomplish which is to stop a pick up counter from resetting when the player dies. The goal of this game is to pick up pants as a car (don’t judge my game here LMAO). For some reason the pants pick up counter resets to 0 upon death.

I tried to use GameState (Learned most of has to do with Mulitplayer stuff) but I can figure out why I cannot cast a variable from Game State that has been stored in the GameState itself. (Yes I did go to the world settings and enable this game state to be used) How do I fix this problem?

When I try to connect the “As Game State” to the “Target (self)” it says that it is not compatible. I do not know why this is happening. I tried to restart the engine to see if that fixed it, but it did not.

This issue is killing me. I really cannot solve this and I feel so silly I cannot do this correctly.

Okay now I got another issue. Choosing a new GameState aside from the original causes my game to be frozen on play. Like my pawn refuses to move and actors that rotate will not move either, but sounds play normally. One problem after another. This is exhausting.

Hey Thanks for the reply! Yeah I casted the wrong state like a dummy. Also I noticed the game was frozen because I created a new game state bp that referenced game state when it needed to be referenced from Game State Base. Thanks a ton dude. I am now going to rework this and see if it works! I let you know if it does. You are a hero

IT WORKED. Thank you so much. I would have never been able to figure this out on my own. Thank you. I am definitely going to add you on the credits page for helping me.

Okay, have you set the int ‘PantsUpCounter’ in the game state? Also, regarding the image you supplied us with, the target for ‘PantsUpCounter’ would be applicable with the ‘As Game State’ cast to node.

Also, create your own ‘BP_GameState’ and make sure that the Game Override for your map is set to include ‘BP_GameState’ as your Game State. When you go to cast to this object, you will search for ‘BP_GameState’. You will not cast to the default ‘GameState’ unless you have set the variable there.

Haha. Do what you please! Glad to help you. (:

My Insta is Seniattusstudios You can check out my game progress there if you’d like! Right now I am creating a save and load function for the game. Really daunting stuff.

Answer is in the comments