I want to create a plugin widget that initiates with a set size, however, Roblox studio refuses to set the widget to the values that I give it.
I’ve tried looking around for any other people with similar issues but for some reason I don’t see anyone talking about this.
Heres my code:
local toolbar = plugin:CreateToolbar("testplugin")
local button = toolbar:CreateButton("Button", "", "")
local HttpService = game:GetService("HttpService")
button.ClickableWhenViewportHidden = true
local widgetinfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float, --initDockState
true, --initEnabled
true, --overrideEnabledRestore
200, --floatXSize (initial X size)
200, --floatYSize (initial Y size)
50, --minHeight
50 --minWidth
)
local function CreateWidget()
-- creating a new widget with a completely unique id(in order to avoid it from restoring to a previous state)
print("widget")
local temp = plugin:CreateDockWidgetPluginGui(HttpService:GenerateGUID(true), widgetinfo)
-- inital size
print(temp.AbsoluteSize);
-- wait 0.5 seconds and print new size
task.wait(0.5);
print(temp.AbsoluteSize);
return temp
end
button.Click:Connect(CreateWidget)
My output shows that although the widget initially starts at around the right size, something is causing it to resize afterward.
I’ve tried multiple different floatXSizes, floatYSizes, and min heights/widths but none of them seem to work. The initial X size is always -2 off the floatXSize and the initial Y size is always off by -25. Roblox also seems to resize the widget to be 1592, 150 afterward regardless of what floatXSize & floatYSize I give it.
Is there anything I’m missing?
Thanks,