Replicate player variables in a multiplayer mode

Godot Version

4.2

Question

Hello, i’m trying how to synchronise player properties in a multiplayer mode. I guess its very simple, but i cant understand with tutorials i found on the internet, can you please give me a short clue in order to do it ?

Example, i want to instantiate from my main scene world, a new player (i done it aloready), but with a playername above head.
When i change my var nickname on player, it doesnt work.
How can i synchronize variables of player script on other peers ?

I tried this : Multiplayer in Godot 4.0: Scene Replication (part 1)

but it seems outdated, this line doesnt work : multiplayer.replicator.spawn_config(id, MultiplayerReplicator.REPLICATION_MODE_SERVER,
[&“player_name”, &“position”])

thanks a lot !

1 Like

are you just trying to add nametags to the player? because you can do that entirly in the player scene

Curious about this as well.

Let’s say we have a basic enemy that can either be on the red team or the blue team.

When we spawn it in with a multiplayer spawner, before we do spawn_point.add_child(newly_instanced_minion, true) we might want to call newly_instanced_minion.team = 0 or 1

However, it seems the default behavior of the spawner is to disregard these sorts of changes maybe? Is there some property that will allow the synching of script variables that have been set prior to being added to the tree?