Attempted to access vehicleBluePrint, but VehicleBluePrint is pending kill

Hi, Im new to UE4 and was following a tutorial from an older version of UE4 and have run into a problem when running the game. I get the error message seen within the MessageLog and have no idea how to fix it and would very much appreciate some help. If any more details are needed I can supply them.

image of cast nodes
Screenshot by Lightshot Screenshot by Lightshot Screenshot by Lightshot

Image of error

Image of script

Link to the tutorial I have been following - BP Time Attack Racer: Lap Display & Respawn Handling | 07 | v4.8 Tutorial Series | Unreal Engine - YouTube

Thanks in advance

Do you mean the script for the VehicleAdvHud or something else? I dont quite understand what part of the code you would like to see

Actually I believe these are the cast nodes you are looking for

Looks like a screen shot of the wrong node causing the error. Where is the cast node it is trying to pull a reference for that is null/pending kill?

Yea, either you are trying to cast before the vehicle exists or you are casting after the vehicle got destroyed or the vehicle is not a “pawn” or “character”. That would be the reasons for that error.

How do I fix it?
Is there some sort of delay function I can add in to cast after wards, or something were I can check if my vehicle gets casted after it is destroyed or a way to check if my vehicle is a pawn of a character?

You can always use the “is valid” node right before trying to use that pawn reference. Make sure the pawn is valid first. **Still not 100% sure that is the bad node either FYI. Also noticed you have another error with the controller ref in the 2nd image. So that must be an empty reference container and you never “set” the controller.

I would recommend checking out video #1 and video #25 in this series. It explains how to properly cast and the other video shows you a bunch of ways to create references. Both of which seem to be issues here. Fixing it requires making proper references, setting the variables before using them, casting objects that inherit from the class you are trying to cast to etc. The link should help get you looking in the right direction.