PluginToolbar
A PluginToolbar is an object created by using the Plugin:CreateToolbar() method. It is used to create PluginToolbarButtons using the CreateButton function. In general, it is good practice for a plugin to use one and only one uniquely named toolbar for all of its buttons. In Studio, toolbars are rendered under the Plugins tab.
The following code sample creates a basic toolbar with one button. It should be run as a Studio plugin, not as a Script.
local toolbar = plugin:CreateToolbar("Three Wise Monkeys")local button = toolbar:CreateButton("Mizaru", "See No Evil", "rbxassetid://2778270261")
Resumen
Propiedades
Métodos
- CreateButton(buttonId : string,tooltip : string,iconname : string,text : string):PluginToolbarButton
Creates a PluginToolbarButton that allows the user to initiate a single, one-off action in Studio.
Propiedades
Métodos
CreateButton
Creates a PluginToolbarButton that allows the user to initiate a single, one-off action in Studio through its Click event.
Parámetros
A unique button ID.
The text displayed in the tooltip shown when a user hovers over the button.
The asset ID (e.g. rbxassetid://1507949215) of the icon displayed in the button.
Text displayed under the button icon. Optional. If this field is not provided, the ID will be used instead.
Devuelve
The created PluginToolbarButton instance.
Muestras de código
local ServerScriptService = game:GetService("ServerScriptService")
local toolbar = plugin:CreateToolbar("Empty Script Adder")
local newScriptButton = toolbar:CreateButton("Add Script", "Create an empty Script", "rbxassetid://1507949215")
local function onNewScriptButtonClicked()
local newScript = Instance.new("Script")
newScript.Source = ""
newScript.Parent = ServerScriptService
end
newScriptButton.Click:Connect(onNewScriptButtonClicked)