Collapse Sidebar


StartDrag initiates a drag action using a dictionary of parameters. The parameters are as follows:

Name Type Default Description
Senderstring"" Identifies the source of the drag action to the drop target
MimeTypestring"" The MIME type of Data.
Datastring"" Information about the drag action (eg. what is being dragged). Should be used by the drop target.
MouseIconContent"" The icon to use for the mouse cursor during the drag. If empty, uses the default cursor.
DragIconContent"" An image to render under the mouse cursor during the drag. This should represent the item being dragged.
HotSpotVector2Vector2.new(0, 0) The pixel offset from the top-left where the cursor should "hold" the DragIcon.

See Also

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


Name Type Default Description


Return Type Summary

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)