How to move player via networking?

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

Someone know why this code doesn’t work?:

remote func _damaged(direction):
    velocity = direction * 200
    velocity = Player.move_and_slide(velocity)
func _on_HitArea_body_entered(body):
    if is_network_master():
        rpc_id(int(, "_damaged", hit_direction)

I got “test” printed on the right player, but neither StateMachine nor velocity work. Does someone know what’s happening?

I tried get_parent() instead of Player, but it didn’t help either.
Also I tried using rset_id(“velocity”, hit_direction * 200), but it didn’t work too

What I try to achieve is to move one player via a network, when he got hit by another player

Player is reference to get_parent()
StateMachine is reference to get_node("../AnimationTree").get("parameters/playback")

Edit2: I found out that if I print get_parent() in func _damaged() then it shows not the player who should receive signal, but the player who sends rpc. For example when id 23112 sends rpc_id(1, "_damaged"), in func _damaged() in print(get_parent()) there is printed 23112. I’m really confused right now why it happens because I got a “test” printed on the client with id 1.

try remotesync

supper_raptor | 2020-04-19 18:51