We use cookies on this site to enhance your user experience

DockWidgetPluginGui — Hello World Example

DockWidgetPluginGui — Hello World Example

This code sample when ran as a Plugin, will create a DockWidgetPluginGui with an orange button that says “Hello world!”.

local info = DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Float, -- Window will be initialized in a floating state.
	true,                        -- Window will be initially enabled.
	false,                       -- Don't override the saved enabled/dock state.
	200,                         -- Width of the floating window.
	100                          -- Height of the floating window.
)

local pluginGui = plugin:CreateDockWidgetPluginGui("Hello_world_widget", info)

local testBtn = Instance.new("TextButton")
testBtn.TextScaled = true
testBtn.AnchorPoint = Vector2.new(0.5,0.5)
testBtn.Size = UDim2.new(1,0,1,0)
testBtn.Position = UDim2.new(0.5,0,0.5,0)
testBtn.SizeConstraint = Enum.SizeConstraint.RelativeYY
testBtn.BackgroundColor3 = Color3.new(1,0.5,0)
testBtn.Text = "Hello world!"
testBtn.Parent = pluginGui