I really hope I can get an answer for this one!
My issue is I’m trying my best to spawn an object for each player on the server, but the only thing is it continues to return null when a non-local player joins the game
here’s a bit of code showing my issue
void Start()
{
if (isLocalPlayer)
{
if (otherSettings.startWeapon)
{
TransmitStartWeapon(otherSettings.startWeapon);
}
}
}
[ClientCallback]
void TransmitStartWeapon(GameObject wep)
{
if (isLocalPlayer)
{
Cmd_SpawnStartWeapon(wep);
}
}
[Command]
void Cmd_SpawnStartWeapon(GameObject wep)
{
GameObject newWep = Instantiate(wep, transform.position, transform.rotation) as GameObject;
weaponH.currentWeapon = newWep.GetComponent<Weapon>();
NetworkServer.Spawn(newWep);
}
The weapon is registered as a spawnable prefab, and this script is attached to the player.
I pray you guys can actually get baack to me with this question, I’ve never had anyone answer me on here