> For the complete documentation index, see [llms.txt](https://rsb.inanevin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rsb.inanevin.com/getting-started/incorporating-player/player-with-weapon.md).

# Player With Weapon

Since we understood the basics of how to incorporate a player object with RSB, now we can use our prefab that actually has a weapon controller. **Delete** the **Player Without Weapon** object from hierarchy, then navigate to **InanEvin>Realistic Sniper and Ballistics>System Prefabs** folder & drag & drop the **Player With Weapon** prefab into the scene. Set it's position to **0,1,0.** At this point, we do not need our **Tutorial.cs** script to fire, aim, or change the zero distance for us, as this will be done by the **PlayerWeaponController.cs** coming with the **Player With Weapon** prefab. So, let's open up our **Tutorial.cs** and comment out the unnecessary lines:

{% embed url="<https://gist.github.com/c59f1672b21c5405c41c7bf9aa7afb5f.git>" %}

Now our **Tutorial.cs** script is only responsible for spawning hit effects.

Just as the beginning of the previous section, we'd have lost references to the **Main Camera**. So, go to **Sniper and Ballistics** object, assing the **Main Camera** under the new **Player With Weapon** object in the scene to the **Fire Transform** field of SniperAndBallisticsSystem.cs instance. Then, go to the **ScopeReticle** object and assign the same **Main Camera** to the **Main Camera** field of **DynamicScopeSystem.cs** instance.&#x20;

Now if you open up the hierarchy of **Player With Weapon** object, you will see under the Main Camera, there is a **Weapon** object, that has a **PlayerWeaponController.cs** component attached to it, as well as MotionController.cs attached to it in order to control the weapon's movement.&#x20;

![PlayerWeaponController.cs attached to Weapon object.](/files/-MaOVp98JCU623aAbnE_)

**PlayerWeaponController.cs** does exactly what we did in our **Tutorial.cs**, just in a more complicated fashion in order to create the behavior of a bolt-action sniper rifle. Before we can try this out, there are couple of fields we need to fill. First, drag & drop the **Bullet Time - Bullet** object in the scene to the **Bullet Time Bullet** field of **PlayerWeaponController.cs** component.

Then, we need to create 2 new poolers, so create 2 new empty game objects, rename them as **Shell Pooler** and **Muzzle Flash Pooler**, then add the **ObjectPooler.cs** component on them. At this point, you should have been pretty comfortable adding new poolers, so go ahead and assign the necessary prefabs for them. **Shell Pooler** will use the prefab **Bullet Shell**, and the **Muzzle Flash Pooler** will use the prefab **Muzzle Flash.**

![Muzzle Flash & Shell poolers.](/files/-MaOWiRsc55RckmZE4-S)

Go back to our **PlayerWeaponController.cs** component and attach these poolers to their respective fields. Then lastly, we need a **text** component in the scene to display the remaining ammo. Navigate to **InanEvin>Realistic Sniper and Ballistics>System Prefabs** folder and drag & drop the prefab called **CANVAS - Crosshair & Ammo** into the scene. This is just a very simple Unity Canvas that has an image for a crosshair and a text for ammo display. Drag & drop the text called **Ammo Display** under this canvas to the **Ammo Text** field in **PlayerWeaponController.cs**. So, it should look like this now:

&#x20;

![Bullet Time Bullet, Shell Pooler, Ammo Text and Muzzle Flash Pooler fields assigned.](/files/-MaOXLFGe2t05WdUQqQb)

Now if you play the scene, you can walk, sprint & jump around, while shooting a sniper rifle. And if we hit the bullet time target, it will trigger the bullet time effect!&#x20;

![](/files/-MaO_dk7-8wOW_T8Z9M2)
