destroy player cloned weapon (multiplayer

Hi, i have a game setup where a player can instantiate a weapon with rpc and destroy it to swap in a different weapon that with testing i can see through other connected clients but my problem is I don’t know how to destroy that specific cloned weapon for that one player.

Destroy(GameObject.Find("Short_Sword(Clone)"));  

will work for singleplayer if theres only one player and no monsters use that same weapon name. But since this is multiplayer im trying to figure out what I can use instead. I’ve been looking up references for awhile but i can’t seem to quite find what i need.

I think it would be something like find gameobject owned by player (maybe view id or something in there) of short_sword(clone) and destroy? I’m hoping its something simple anyways. Will continue research

As you may have found out - you can’t reference gameObjects over an RPC, right? So in other words, you can’t do ‘Destroy(sword.gameObject)’ over clients in an RPC.

But there are multiple ways to reference a gameObject over a network, and destroy it. For your problem, you can just do this:

Network.Destroy(gameObject);

You don’t have to call it over an RPC either - call it locally, and the network will do the rest for you!