Collapse Sidebar


PluginDragLeft fires when the user’s mouse leaves a PluginGui during a drag operation started by Plugin/StartDrag.

This event and PluginGui/PluginDragDropped|PluginDragDropped are useful for hiding a “Drop Here” UI on PluginGuis where a drag operation can be dropped. Such a UI should be shown when either PluginGui/PluginDragEntered|PluginDragEntered fires.

See Also

  • articles/Drag and Drop in Studio Widgets
  • PluginGui/PluginDragEntered
  • PluginGui/PluginDragMoved
  • PluginGui/PluginDragDropped


Name Type Default Description

A copy of the data originally passed to Plugin/StartDrag

Code Samples

Plugin Drag and Drop

This code sample creates two plugin widget windows: a drag source and a drop target. In the source window, the script creates a TextBox and TextButton to allow the user to begin a plugin drag action. The drop target window will display the MimeType of whatever is dragged into it using a TextLabel. If the MimeType is text/plain, it will display the plain text data instead. Pictured below is an animation of the drag and drop action.

Screen recording of the drag and drop action in-Studio

To run this code sample as a plugin, paste it into a Script. Then, right-click the script in the Explorer window and choose “Save as Local Plugin”.

-- This script must be run as a Studio plugin

local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)

-- We'll start drags from this widget
local dragSourceWidget = plugin:CreateDockWidgetPluginGui("Drag Source", widgetInfo)
dragSourceWidget.Title = "Drag Source"

-- This TextBox allows the user to type the text to drag
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hello, plugin drags"

-- This TextButton will allow the user to start the drag
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1,0,1,-32)
dragButton.Position = UDim2.new(0,0,0,32)
dragButton.Text = "Edit the text above, then start drag here"
dragButton.Parent = dragSourceWidget

function onMouseButton1Down()
	local dragData = {
		Sender = "SomeDragSource";
		MimeType = "text/plain";
		Data = textBox.Text;
		MouseIcon = "";
		DragIcon = "";
		HotSpot = Vector2.new(0, 0);


-- This widget will receive drops
local dragTargetWidget = plugin:CreateDockWidgetPluginGui("Drop Target", widgetInfo)
dragTargetWidget.Title = "Drop Target"

-- This TextLabel will display what was dropped
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Drop here..."
textLabel.Parent = dragTargetWidget

local function onDragDrop(dragData)
	if dragData.MimeType == "text/plain" then
		textLabel.Text = dragData.Data
		textLabel.Text = dragData.MimeType


dragTargetWidget.PluginDragEntered:connect(function (dragData)

dragTargetWidget.PluginDragLeft:connect(function (dragData)

dragTargetWidget.PluginDragMoved:connect(function (dragData)