Blueprint error Help!

I’m trying to create a scoring system. But it’s not working for some reason?? The first image compiler results say " The execution path doesn’t end with a return node. Cast failed. The 2nd image is my pawn class where I spawn the meshes right when the game starts and I put a BP so that when it gets destroyed it adds one to score. The third image is my Player controller BP with me default settings.
I already removed the print string thing. The last image is my error saying that everyone the mesh spawns in the game (the mesh is called thing) and when I destroy it, it can’t add my score. What’s wrong??? Is there a way to fix this or a better way to add a scoring system. I tried searching online everywhere for tutorials for scoring but there not helping??

60658-4.png

The error itself says that the variable “Score” in your “EventGraph” of the blueprint “Thing” is None. Basically the variable is empty and you try to get information out of thin air.

If I see that correctly your “Score” variable in the second picture is an actor. Where did you get it from / where did you set it if at all?

Because you will need a reference to a “Score” actor within your level.

Friendly heads up score would usually be handled in either your player character, game mode, game state or player state. A separate actor makes access harder, does not scale well with more players and needs to be spawned / placed each time.

Cheers

The score variable is in my player controller and its a function within the player controller. Its not an actor. And I called the function through the actor where I’m destroying it as seen in second image. I’m not best in BP how do I create a reference to score within my level.

In your second image, the “Score” variable is clearly an actor (blue icon). You appear to be the casting your PlayerController (in EventPossessed) to MI (whatever that is) to set the Score variable. If MI is not of type PlayerController, this cast will always fail!

What type is the “Score” variable then?

It looked like the actor blue to me.

And you get references primarily via the normal relation (player controller, player character, game mode, etc. They are by default connected), via events like Overlap or Hit where you get a reference to the actor or by saving them right after they’re spawned. You can also resort to get things directly from the level via “Get All Actors of Class” but that is a rather dirty way of doing things.

Also you should really take the advice in your other thread and use player state instead. It’s specifically designed to contain information about the player for example score and can be accessed everywhere you can access your player controller.

Ya I realized that I need to put it in my player controller

Well I don’t have an actor called Score (but I’ll double check) and MI is the player controller.