Note: you need know roblox basic scripting!
Hello! So im pretty sure you wanted to create your own plugin but didn’t knew how. In this tutorial I will explain you how to create your own plugin! Let’s do for example a script inserter plugin.
Step 1 - Creating plugin on toolbar
Step 2 - Scripting button
Step 3 - Adding gui for our plugin
Step 4 - Creating non widget gui
Step 5 - Publishing plugin
Step 6 - The End
So first we need add our plugin onto plugins toolbar. To do this we need create a new script. You can paste it anywhere.
After what you must type this:
local toolbar = plugin:CreateToolbar("Plugin Name")
We have created a toolbar on plugins.
Plugin Name is a name of your toolbar. You can name it whatever you want! Okay we added a toolbar but what about buttons?
local pluginButton = toolbar:CreateButton( "Insert Script", --Text that will appear below button "Button to insert a script", --Text that will appear if you hover your mouse on button "rbxassetid://8740888472") --Button icon
Note: button image must be Image ID and not Decal ID. Its the best if button icon is 16x16 or 32x32 and not an GFX. Since its only example I took random image from toolbox
The simplest way to turn Decal ID into Image ID is to put Decal ID into
Image property and boom! You got Image ID
So what we just did is created a button onto our plugin. To test it you must save your plugin:
And your plugin will appear on toolbar!
However it does nothing if you click it. So let’s make it work. You will need to repeat this step everytime you adding something new to script in order to test it!
pluginButton.Click:Connect(function() print("Button has been clicked.") end)
If in your output it printed out
Button has been clicked. then everything works fine! You can do your own plugin now! However my plugin is about to insert script so im going to finish it.
pluginButton.Click:Connect(function() local scrp = Instance.new("Script") scrp.Source = "" scrp.Name = "EmptyScript" scrp.Parent = game.ServerScriptService end)
Great! Our plugin creates a script as we wanted! But what about if we want insert a local scirpt? Sure we can create another button that inserts local script… But we don’t like easy ways! Right?
Actually I just need a reason to create a gui for plugin.
So you can create gui in normal way you want to. I will use this one:
So now we must drag our gui inside script. However I recommend creating a folder which contains plugin source. Also if you insert ScreenGui nothing gonna work.
So now we must make it that our gui appears when plugin clicks. We going to make it in widget form!
But first we need widget information.
local info = DockWidgetPluginGuiInfo.new( Enum.InitialDockState.Right, --From what side gui appears false, --Widget will be initially enabled false, --Don't overdrive previouse enabled state 200, --default weight 300, --default height 150, --minimum weight (optional) 150 --minimum height (optional) )
But it won’t create actual widget. To create actual widget we need create it.
local widget = plugin:CreateDockWidgetPluginGui( "TestPlugin", --A unique and consistent identifier used to storing the widget’s dock state and other internal details info --dock widget info )
But if we test it now nothing gonna happen. Why? Because we didn’t finished some things!
widget.Title = "Insert Script GUI" --Giving title to our widget gui
Cool! But what about our gui that we want to be in our widget? To do it we need parent it to our widget
script.Parent.MainFrame.Parent = widget
I lied. The widget doesn’t shows because we didn’t enabled it. So let’s do this!
pluginButton.Click:Connect(function() widget.Enabled = not widget.Enabled end)
Now if we test it now it will appear! So let’s now script our buttons. You can script them as you usual. Nothing changed here so im not going to explain anything here.
local buttonScript = mainFrame.InsertScript local buttonLocal = mainFrame.InsertLocalScript buttonScript.MouseButton1Click:Connect(function() local new = Instance.new("Script") new.Source = ""; new.Name = "EmptyScript"; new.Parent = game.ServerScriptService end) buttonLocal.MouseButton1Click:Connect(function() local new = Instance.new("LocalScript") new.Source = ""; new.Name = "EmptyLocalScript"; new.Parent = game.ServerScriptService end)
Great! But what if I don’t want create it as a widget? Well let’s do this then!
So this time we will need screen gui. This time we need parent gui to
CoreGui. You may ask “Why not in
PlayerGui?” Well the answer is simple. Not
StarterGui Because if user will run the game plugin will be in the game too. User also will be able to modify the gui which we don’t want. Not
PlayerGui because there no any player. It’s almost just like with widget but without info table.
local CoreGui = game:GetService("CoreGui") --Getting CoreGui local gui = CoreGui:FindFirstChild("PluginGui") or script.Parent.PluginGui gui.Enabled = false --Making gui invisible gui.Parent = CoreGui --Parenting gui to coregui pluginButton.Click:Connect(function() gui.Enabled = not gui.Enabled --Enabling/Disabling gui after button clicked end)
Thats it! But how do you make it so everyone can use your plugin? You must publish it!
Configure it as you need. After you done you must enable sale so people can install it:
And then you can submit it!
That’s it! You have created your own plugin! Bye!