So I was messing around with plugins, and I ran into an error:
local Toolbar = plugin:CreateToolbar("Scripts")
local button = Toolbar:CreateButton("Add Script", "Add Script", "http://www.roblox.com/asset/?id=145111737")
local function buttonClick()
local Script = Instance.new("Script", game.ServerScriptService)
Script.Source = "\
print('Hello, World!')\
print('Test1')"
end
This is my code, and the error is “Attempt to index nil with ‘CreateToolbar’”
Thanks in Advance
Add this as the first line
local plugin = PluginManager():CreatePlugin()
local plugin = PluginManager():CreatePlugin()
local Toolbar = plugin:CreateToolbar("Scripts")
local button = Toolbar:CreateButton("Add Script", "Add Script", "http://www.roblox.com/asset/?id=145111737")
local function buttonClick()
local Script = Instance.new("Script", game.ServerScriptService)
Script.Source = "\
print('Hello, World!')\
print('Test1')"
end
Okay wait yours should work actually, are you remembering to save it as a local plugin?
https://developer.roblox.com/en-us/articles/Intro-to-Plugins
Yes, I saved it as a local plugin.
Okay I tried it out myself and it was working for me, did you put it somewhere else besides ServerStorage
?
Yes, it’s in ServerScriptService
Am I supposed to put it in ServerStorage?
I placed it in ServerStorage and it was working fine for me, maybe try that?
1 Like
Alright, it’s working, thanks!
1 Like