Class · inherits LayerCollector
PluginGui
An abstract base class for GUIs that display GuiObjects in
Roblox Studio widgets.
About PluginGui
PluginGui is an abstract class for GUIs that allow the display of
GuiObjects in various Roblox Studio widgets. As of right
now, the only available PluginGui type is DockWidgetPluginGui, but
there may be more in the future!
Properties 1
Methods 2
BindToClose
(function: Function = nil) → ()Binds a function that runs when the user closes thePluginGui.This method binds a function that runs when the user clicks the close button of the
PluginGui. The widget closes and itsEnabledproperty becomesfalseeven when a function is bound, so the function can't prevent or delay closing. Use it to perform tasks such as saving work when the widget closes.For example, the following code saves work when the user closes the widget:
local function saveWork() -- Save the user's work here. end pluginGui:BindToClose(function() saveWork() end)Call
BindToClose()without an argument to unbind the current function:pluginGui:BindToClose()See also:
Plugin.CreateDockWidgetPluginGuiAsyncto create aPluginGuiDataModel.BindToClose, which can be used to bind a function to the game ending and should not be confused with this function
GetRelativeMousePosition
() → Vector2PluginReturns the position of the mouse relative to the PluginGui.GetRelativeMousePosition returns the position of the mouse relative to the top-left corner of the
PluginGui. The returned value changes only if a mouse input began on the PluginGui, or if the mouse is presently hovering over the window.
Events 6
PluginDragDropped
PluginGui.PluginDragDropped:Connect(function(dragData))PluginFires when the user releases their mouse when hovering over a PluginGui during a drag operation started byPlugin.StartDrag.PluginDragDropped fires when the user releases their mouse over a
PluginGuiduring a drag operation started byPlugin.StartDrag.See also:
PluginDragEntered
PluginGui.PluginDragEntered:Connect(function(dragData))PluginFires when the user's mouse enters a PluginGui during a drag operation started byPlugin.StartDrag.PluginDragEntered fires when the user's mouse enters the
PluginGuiduring a drag operation started byPlugin.StartDrag.This event is useful for displaying a "Drop Here" UI on PluginGuis where a drag operation can be dropped. Such a UI should be hidden when either
PluginDragLeftorPluginDragDroppedfire.See also:
PluginDragLeft
PluginGui.PluginDragLeft:Connect(function(dragData))PluginFires when the user's mouse leaves a PluginGui during a drag operation started byPlugin.StartDrag.PluginDragLeft fires when the user's mouse leaves a
PluginGuiduring a drag operation started byPlugin.StartDrag.This event and
PluginDragDroppedare useful for hiding a "Drop Here" UI on PluginGuis where a drag operation can be dropped. Such a UI should be shown when eitherPluginDragEnteredfires.See also:
PluginDragMoved
PluginGui.PluginDragMoved:Connect(function(dragData))PluginFires when the user's mouse moves within a PluginGui during a drag operation started byPlugin.StartDrag.PluginDragMoved fires when the user's mouse moves within a
PluginGuiduring a drag operation started byPlugin.StartDrag.See also:
WindowFocused
PluginGui.WindowFocused:Connect(function())PluginFires when the user begins interacting with the window of the PluginGui.WindowFocused fires immediately when the user starts interacting with the PluginGui's window, usually by clicking on it. This functions works similarly to the similarly-named
UserInputService.WindowFocusedevent. It fires before anyGuiObject.InputBeganevents related to mouse buttons.If another
PluginGuiis in focus and the user focuses this PluginGui, then this event fires after the other'sWindowFocusReleasedevent. However, if the main game window was in focus, this event fires afterUserInputService.WindowFocusReleased.WindowFocusReleased
PluginGui.WindowFocusReleased:Connect(function())PluginFires when the user stops interacting with the window of the PluginGui.WindowFocusReleased fires immediately when the user stops interacting with the PluginGui's window, usually by clicking on something not in the window. This functions works similarly to the similarly-named
UserInputService.WindowFocusReleasedevent.If focus is moving to another
PluginGuiwhile the user had this PluginGui in focus, then this event fires before the other'sWindowFocusedevent. However, if the main game window is being put in focus, this event fires afterUserInputService.WindowFocused.
PluginGui also has every member of LayerCollector. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.