Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

How To Add An Item That Can Stun Characters

A Tutorial for Baldi's Basics in Education and Learning

No ads for members. Membership is 100% free. Sign up!
Hello! In this tutorial i will show you how to add an item to baldi's basics using the open source decompile that can stun characters for an amount of time of your choosing. (Follow what i do closely, or else it might not work)

Step 1. Open The Open Source Baldi Decompile In Unity

Step 2. Import a 64px by 64px image you would like to use for the item (For this tutorial's purpose, the image I chose is pretty generic)

Step 3. Duplicate one of the existing items (like Pickup_BSODA for example)

Step 4. Rename the duplicate to Pickup_StunItemName (I renamed it to Pickup_StunGun)

Step 5. Give the stun item the texture you chose for it

Step 6. Open the PickupScript in Visual Studio

Step 7. In the script, duplicate the Pickup_SafetyScissors code and paste the copied code below it.  Change the string to the item name you changed earlier, and the number to 10.

Step 8. Go back to Unity. Select the game controller object and scroll down until you get to item textures. Change the size to 11, and after doing that, replace the duplicate scissor texture with the texture of your stun item in element 10.

Step 9. Now open the gamecontroller script with visual studio, and I will show you what exactly you need to do (This is probably the hardest part)

Step 10. Scroll down to the ResetItem code, and under that, between ResetItem() and LoseItem(), paste in this code:

    IEnumerator StunItem(GameObject character)
        float timer = 5f;
        UnityEngine.AI.NavMeshAgent navMeshAgent = character.GetComponent();
        while (timer > 0)
            navMeshAgent.velocity =;
            timer -= Time.deltaTime;
            yield return new WaitForEndOfFrame();

Now, after you put in the code, you are going to notice some errors (Don't worry, I will show you how to fix that)

Step 11.  Hover over IEnumator in the code you pasted, and click on the arrow. using System.Collections; should come up as a fix, click on that. The errors for the IEnumator should go away. (You can change how long the stun lasts for by changing the float timer's number)

Step 12. Now we need to put in the code for the stun item itself. Under the else if for the safety scissors code, copy and paste this code in:

else if (this.item[this.itemSelected] == 10) // Stun Item Code
                RaycastHit raycastHit;
                if (Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f)), out raycastHit) && raycastHit.collider.tag == "NPC" && != "Baldi" && Vector3.Distance(this.playerTransform.position, raycastHit.transform.position) <= 10f)

Now with all the code for the item in, we are almost done! All we need to do now is give the item its in-game name.

Step 13. Go down to where it shows the names of all the items. Under safety scissors, put the name of your item in "" marks. (After doing that save the script and go back into unity)

Now when you play your decompile in unity, the stun item should work! To make sure, test it on some characters like playtime or the principal. If they stop moving after you use it on them for a few seconds, that means it worked!

I hope you enjoyed this tutorial, and that it helped you with making a new item!


Sign up to access this!


Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code


Original Authors
JohnsterSpaceProgram Johnster Space Studio Flag
Johnster Space Studio
Created This Tutorial
Special Thanks
MissingTextureMan101 avatar Ruler Productions Flag
Ruler Productions
MissingTextureMan101 username pic Joined 1y ago
Ruler Productions Flag Affiliation: Ruler Productions
2,097 points Ranked 20605th
18 medals 4 rare
  • 10 submissions featured Medal icon
  • Returned 1000 times Medal icon
  • Received thanks 50 times Medal icon
  • Reached 50 subscribers Medal icon
  • One month a member Medal icon
  • Became a Studio Leader Medal icon
The OSB Project Decompile
Fasguy avatar 30Hz Studios Flag
30Hz Studios
Fasguy username pic Joined 1y ago
30Hz Studios Flag Affiliation: 30Hz Studios
2,423 points Ranked 20218th
12 medals 2 rare
  • Reached 50 subscribers Medal icon
  • Returned 1000 times Medal icon
  • Returned 100 times Medal icon
  • One month a member Medal icon
  • Reached 10 subscribers Medal icon
  • 6 months a member Medal icon
Showing me how to do this originally
ThisMarioFan Joined 4mo ago
109 points Ranked 66681st
How to add new items tutorial


  • Paypal Donate
Sign up to access this!
Sign up to access this!
Sign up to access this!


Sign up to access this!



Difficulty Level



  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • favorite 3
  • remove_red_eye 1.1k
  • mode_comment 6
  • access_time 3mo
  • access_time 3mo

More from Submitter


WiPs by Submitter


More Decompile Tutorials