Getting an attempt to index nil with 'CreateToolBar' error

Hello.
I was reading this topic (Create your first plugin! - Guide on how to use widgets and other stuff) for a starting level of insight on programming plugins.

Edit: However, before I could actually write any code (basically after creating the toolbar) to practice what I learnt, I keep getting the following error:

ServerScriptService.Folder.Script:7: attempt to index nil with 'CreateToolbar'  -  Server
Stack Begin  -  Studio
Script 'ServerScriptService.Folder.Script', Line 7  -  Studio
Stack End

Now, I did a search on Google and found this post (Can't find reason for error "attempt to index nil with CreateToolbar") which is similar to mines, but the solution didn’t work for me either because firstly, I created a Folder instance and then inside of it, I placed just a single Script instance inside of it, and then I followed along with the tutorial above (solely for the purposes of learning).

The script just stops at this line when it errors:
local Toolbar = plugin:CreateToolbar("My Plugins") (So, none of the further code is the problem, and yes I clicked on the Folder, and then I clicked on Save as Local Plugin / made sure its in my Roblox/plugins folder.)
Edit: Is this error stating that the global plugin is nil?

Is anyone able to help me figure out what I’m doing wrong here? I’m not really sure.

1 Like

I don’t believe you are doing anything wrong. plugin does not exist in the ServerScript you are using. When it runs as a (local) plugin, it works just fine, when it runs as the script in ServerScriptServer, it does not because plugin does not exist. You could just disable the script to stop it from giving errors when you press play.

1 Like