Multiplayer. Player positions do not match. What can I do?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NachoGuide

I’m basically making an online multiplayer game where players fly using balloons and they have to pop the other players’ balloons to win (like Balloon fight), to pop them you have to step on them.

Players’ feet and balloons are Area2D, and to pop them I make that if an area that is in the group “feet” enters the area of ​​the balloon, a queue_free is applied to it.

My problem is that there are times when on my screen I pop the balloons to another player and on the other player’s screen that does not happen, so I can see the other player flying without balloons. Which makes me think that it is a problem of non-concordance of the positions on the screens.

This is the part of the script that takes care of the movements:

func _movimiento():
var Vx = 5
if is_network_master():
	#movimiento en X:
	if Input.is_action_pressed("ui_left"):
		velocidad.x -= Vx
	elif Input.is_action_pressed("ui_right"):
		velocidad.x += Vx

	#Movimiento en Y:
	if Input.is_action_just_pressed("ui_up"):
		velocidad.y -= 50 * globos
	
	#Gravedad
	var g = 5
	velocidad.y += g

	rset("puppet_pos", position)
	move_and_slide(velocidad)
else:
	position = puppet_pos