Synchronise Variables between different Players

How do I synchronize Variables between different Players? So im trying to make a Multiplayer Cardgame with GDevelop and P2P. Most of the Time, there are 3 or 4 Player. My Problem is, that I cant Synchronize the Variables between the Players. At the Start of the Game, I create for each Player different Cards and one Card which is the same for every Player. The Variables and the Cards are completely different on each Peer.

Thank you very much for the help.

So you have a random variable to create the hand/deck for each player, and that’ is being done client side without registering the result to other players?

Could you do a single global variable that randomises cards into an object stack and then cards are handed out from that stack to each player?
I haven’t tried this, was just the first thought.

It’s something I want to to do with a game of mine too, so I’m keen to see how you solve this.

I use two randomizer, one for the Number and one for the Color. I combine them and test if another Player has the same Cards, so no card is doubled.

I also don’t understand how to figure out which player is who. I would like to have a player ID so that the right cards are only shown to the right players, but I don’t understand how to get that to work. I played around a bit with P2P::GetLastConnectedPeer() but I always get an empty string out of it, no idea what I’m doing wrong.

I am very new here, so im sorry if im asking stupid questions

Scene variables, that is how you synchronize variables between objects.

I have created 4 scene variables. At the beginning of the scene, I generate random letters for the variables. As a test, I display them where normally the name of the players should be. I get different variables for each player. Did I do something wrong?