With this code, when non-host client players get out of the car, other players runs the same function too. I need help to make this right.
2 issues
-
GetActorOfClass is no good here. You need to store a reference to the original pawn somewhere, either in your vehicle class, or in the playercontroller class.
When player enters vehicle, store the player’s original pawn in the variable, then possess the vehicle.
When player leaves vehicle, possess the variable. -
Possess needs to be called on server side. Luckily, your other nodes (set hidden & set transform) should also work fine from server since they set replicated properties. So you can just move everything to server and don’t even need the Multicast.