PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

CreateDockWidgetPluginGui

This function creates a DockWidgetPluginGui using the provided DataType/DockWidgetPluginGuiInfo.

See the Articles/building studio widgets|Building Studio Widgets tutorial for details on working with custom Studio widgets.

Parameters

Name Type Default Description

Consistent identifier used for storing/preserving the widget dock state and other internal details.

Datatype describing details for the new DockWidgetPluginGui.

Returns

Return Type Summary

Code Samples


Widget GUI Text Button

This code, when ran inside a Plugin, creates a DockWidgetPluginGui with a simple TextButton.

-- Create new 'DockWidgetPluginGuiInfo' object
local widgetInfo = DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Float,  -- Widget will be initialized in floating panel
	true,   -- Widget will be initially enabled
	false,  -- Don't override the previous enabled state
	200,    -- Default width of the floating window
	300,    -- Default height of the floating window
	150,    -- Minimum width of the floating window (optional)
	150     -- Minimum height of the floating window (optional)
)

-- Create new widget GUI
local testWidget = plugin:CreateDockWidgetPluginGui("TestWidget", widgetInfo)

local testButton = Instance.new("TextButton")
testButton.BorderSizePixel = 0
testButton.TextSize = 20
testButton.TextColor3 = Color3.new(1,0.2,0.4)
testButton.AnchorPoint = Vector2.new(0.5,0.5)
testButton.Size = UDim2.new(1,0,1,0)
testButton.Position = UDim2.new(0.5,0,0.5,0)
testButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
testButton.Text = "Click Me"
testButton.Parent = testWidget