Race Position system keeps giving errors

Hi All,

I have been trying to make a simple race game (to learn UE). But i can’t get the player position system to work. I don’t have much programming/scripting experience so i can’t figure out what i’m doing wrong.

I keep getting the following error:

In the HUD it does show the max cars, but the player position states 0.

The function it refers to is this one:

The variables for LastDistance is defined in the parents vehicle pawn:

And the complete blue print that calls the functions is set up like this:

Now i spend like 10 hours on it to find whats wrong, but with no succes. The only thing i noticed is that when i remove the player car from the array, the errors are gone. So it seems to be related to the player car.

If anybody has any ideas or suggestion, it’s highly appreciated :slight_smile:

It seems like your object variables are not valid. You will need to reference the variables first before using it. It applies to all object/actor class variables. This is one of the rules of programming, otherwise you will get invalid object variables.