public void CmdFire(Vector3 position, Quaternion rotation, float speed, float damage, float range, float gravityScale, bool enableRenderer) { // var obj = objectPool.GetFromPool(position); //Grab bullet from pool GameObject bullet = PlayerController.bulletPool.bulletList[PlayerController.bulletPool.curBullet % PlayerController.bulletPool.bulletList.Count]; //getting the bullet script BulletScript bs = bullet.GetComponent <BulletScript>(); bs.Commence(0, damage, false, 0); PlayerController.bulletPool.curBullet++; bullet.transform.position = position; bullet.transform.rotation = rotation; bullet.SetActive(true); int dir = mySprite.flipX ? -1 : 1; //**dealing with the sprite renderer //setting the bullet to face the proper direction and turning it either on or off. SpriteRenderer sr = bullet.GetComponent <SpriteRenderer>(); sr.flipX = mySprite.flipX; sr.enabled = enableRenderer; // print(facingRight); //**setting the velocity for the rigid body Rigidbody2D rb = bullet.GetComponent <Rigidbody2D>(); if (gravityScale > 0) { rb.gravityScale = gravityScale; rb.AddForce(Vector3.up * 200); } rb.velocity = (bullet.transform.right * dir) * speed; bs.explosionInstantiator = explosionInstantiator; NetworkServer.Spawn(bullet); // spawn bullet on client, custom spawn handler will be called , objectPool.assetId }