Plugin Widget MinScale and MaxScale not working

Hello! I am recreating my DevTools plugin with widgets. When I set the Min and Max Size in the WidgetInfo, the plugin completely ignores the values and lets me scale the widget freely. The way I have it setup, it shouldn’t be scalable.

How it should be

image

How it is currently

Here is the code:

local ToggleAdminImport = Toolbar:CreateButton("Toggle Admin Importer", "Opens the Admin Impoter", "rbxassetid://9493694927")

--Enabled Variables
local AdminImportEnabled = false

--Plugin Guis
local AdminImportGui = script.Parent.Guis.AdminImporter

--Plugin Widgets
local AdminImportWidgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, false, false, AdminImportGui.Size.X.Offset, AdminImportGui.Size.Y.Offset, AdminImportGui.Size.X.Offset, AdminImportGui.Size.Y.Offset)
local AdminImportWidget = plugin:CreateDockWidgetPluginGui("AdminImport", AdminImportWidgetInfo)
AdminImportWidget.Title = "[DevTools] Import ModularAdmin"
AdminImportGui.Parent = AdminImportWidget

ToggleAdminImport.Click:Connect(function()
	if AdminImportEnabled then
		plugin:Deactivate()
		
		AdminImportWidget.Enabled = false
		AdminImportEnabled = false
	else
		plugin:Activate(true)
		
		AdminImportWidget.Enabled = true
		AdminImportEnabled = true
	end
end)

DockWidgetPluginGuiInfo doesn’t have Max values. The best thing you can do is to scale your GUI instead.

Can you explain to me how I could scale the gui with it?

1 Like

A UDim object is constructed with 2 values, Scale and Offset, UDim2 is constructed by 2 UDims, X and Y. This is the value of every GuiObject’s Size and Position you should see normally.

  • Scale is measured like percentage by the Parent’s size. Scale=0.5 meaning the GuiObject will measure half it’s parent, Scale=0.25 means a quarter of it, regardless the size.
  • Offset is measured after Scale by pixels. Offset=50 means the GuiObject will add up 50 pixels.

Further explanation can be viewed here: Intro to GUIs, but you should understand enough how scaling works in GUI and fix your Plugin.

Well I meant the default size, MinWidth, and MinHeight. Those values are being ignored by the plugin script completely.

Could you scale the GUI down? From the screenshot you provided you only scaled it up.

When I press the button to open it, it either scales to large on it’s own or to small on it’s own.

Am I right?:
You want to scale the Frame inside the DockWidget Plugin?
Or do you want the DockWidget to be one size?

When I set the gui scale to {1, 1} (not the offset), all the objects go to random positions

If possible, I would like no scaling of the widget at all

As @HMgamingTheSecondary said, that isn’t possible. What you can try is scaling the Frame (inside the DockWidget) to the same size as the DockWidget.

This is the problem with that. It doesn’t like the scaling

And the other UI Elements, are they scaled with the scale? This should solve the weird problem.

1 Like

They go to random positions because the objects aren’t using scale positioning

just try to fix the positions and keep it as scale

1 Like

This fixed it, thanks!

3 0 c h a r

1 Like