Problem replicating variable

Hello, not sure about the term used into the title (instancing). Here my prob. i’m trying to create a system to let my character enter different car types. i followed a tut i found around, and for one car it works perfectly. But as soon as i try with other cars, everything works fine, except i canno’t exit the cars that aren’t the last one created.
let’s say i create car 1 it worls perfectly. then i create car2. car2 works perfectly, and car1 works too except that i canno’t exit of car1
according to the message logger, the problem comes from the variable character of that line

this is the kind of error i get

Hello, i’m not making a multiplayer game. i’m making a simple third person enter/exit vehicle. i have a thirdperson BP, a car (third person) BP. when the character approaches the car, you enter the car (and drive) by pressing a key. The first shot is the car (that stopped working. which when i enter i can’t exit anymore). here’s the third person BP

and again the car with the variables

i found an asset in my vault who does this. and it seems in their case they used a main car BP, and every car as childs

Hi, could you explain a bit more / in other words what you’re trying to do =) ?

problem replicating variable

Is this for multiplayer, or what do you mean with “replicating variable”?


  • Your code above will not work for multiplayer (will fail if the client hits the F key, since Possess needs to happen on server).

  • It says that Character2 is None, can you show an image where you set that variable?

  • Where is the code in the first image from? Is it the car, or the character, or… ?

I don’t know why sometimes you post, and your post disappears only God knows where. So, i’m trying to make the following. You control a thirdpersoncharacter, when you come next to a car you can enter it, and drive around (but i’m trying to do this with several cars types). the first pic is from the car. you can see the whole part here car - Share Text and this is the character part Paste is expired - Share Text . unfortunately i can’t post any image, because the image uploading system seems bugguey today. i set up the character variable into the car blueprint, as a character type variable. and yes i think the problem comes from that thing equally. i checked an asset i own that uses several different cars. and in their asset they set up a master car blueprint, and childs blueprints for each car type. and thanks for the help btw

Uncheck “ConsumeInput” in your Input key events in your car. Otherwise only one of those F input events will execute that’s at least one reason the code will fail if you have more than one car type.

A better solution would be to use an interface instead of casting, then you can do with only one of those input events and would avoid code duplication. Or consider using inheritance and implement the “character” variable in the base class and then cast to the base class (where you then should only have the code but no references to meshes/textures). But keep in mind that as soon as you use casting to the car class, you have a reference to it. That means then that this car class and everything it references will be loaded into memory as soon as the character class is loaded into memory (same the other way around since you have an object reference to character from your car).

Thanks for the help. but the problem is very likely recurrent. it happens to lot of people. so i decided to follow a tut provided with a marketplace cars pack. i made it work fine on a simple map test. but when i try on my world composition project map i canno’t make the thing call my playercontroller. for some weird reason whatever i do it keeps calling a playercontroller from i don’t know where