Godot Version
v4.1.1
Question
I am quite new to multiplayer in godot 4 and I am having problems with RPC calls.
I am getting these two errors:
Correct me if I’m wrong but I understand that this error is usually thrown when the scene trees on client and server sides aren’t the same.
This is my script:
@rpc("any_peer", "call_remote")
func pickedUp(instance, Name, id):
if Name == "medKit":
var g = medKit.instantiate()
var floor = get_parent().get_node(instance)
floor.queue_free()
var node_path = "/root/Node3D/"+id+"/HoldingPos/"
if has_node(node_path):
var node = get_node(node_path)
node.add_child(g)
if Name == "throwableGrenade":
var g = Throwablegrenade.instantiate()
var floor = get_parent().get_node(instance)
floor.queue_free()
var node_path = "/root/Node3D/"+id+"/HoldingPos"
if has_node(node_path):
var node = get_node(node_path)
node.add_child(g)
The thing is that if the name is “medKit” the code runs completely fine but when it’s “throwableGrenade” it throws the errors and I don’t understand why.