I have a script that is supposed to load a weapon scene as a child for the player. The function load_weapon() takes a resource containing the weapon scene and position information and uses it to create the child node containing the weapon. The resource class is pweaponres, which is forced by the function input.
When load_weapon() is called to swap weapons in game (loading during _ready() is fine), the peer swapping weapons works fine, but their opponent gets the error "cannot convert function from object to object" and the new weapon does not load. Both the function input and variable declaration are forced to have the class pweaponres, so I'm not sure what the problem is.
Also, when I change load_weapon() to accept any variable type, the client crashes when they connect. The client's error is (Error: E 0:00:07:317 pweaponrig.load_weapon: Invalid access to property or key 'SCENE' on a base object of type 'EncodedObjectAsID'.<GDScript Source>pweaponrig.gd:26 @ pweaponrig.load_weapon() <Stack Trace> pweaponrig.gd:26 @ load_weapon())
Does anyone know what the problem is?
script is attached below