Aprender
Clase de motor
PluginGui
No creable
No replicado

*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.



Referencia API
Propiedades
Title
Leer paralelo
Capacidades: UI
PluginGui.Title:string

Métodos
BindToClose
Capacidades: UI
PluginGui:BindToClose(function:function):()
Parámetros
function:function
Valor predeterminado: "nil"
Devuelve
()

GetRelativeMousePosition
Seguridad del plugin
Capacidades: UI
PluginGui:GetRelativeMousePosition():Vector2
Devuelve
Muestras de código
PluginGui:ObtenerPosiciónDelRatoRelativa
local RunService = game:GetService("RunService")
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
false, -- Estado habilitado, anular
200,
300, -- Tamaño
150,
150 -- Tamaño mínimo
)
local testWidget = plugin:CreateDockWidgetPluginGuiAsync("TestWidget", widgetInfo)
function update()
local v2 = testWidget:GetRelativeMousePosition()
testWidget.Title = ("(%d, %d)"):format(v2.x, v2.y)
end
RunService.Stepped:Connect(update)
update()

Eventos
PluginDragDropped
Seguridad del plugin
Capacidades: UI
PluginGui.PluginDragDropped(dragData:Dictionary):RBXScriptSignal
Parámetros
dragData:Dictionary
Muestras de código
Plugin de Arrastrar y Soltar
assert(plugin, "Este script debe ejecutarse como un complemento de Studio")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Fuente de Arrastre", widgetInfo)
dragSourceWidget.Title = "Fuente de Arrastre"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hola, arrastres del complemento"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Edita el texto de arriba, luego comienza a arrastrar aquí"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- Este widget recibirá las gotas
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Objetivo de Caída", widgetInfo)
dragTargetWidget.Title = "Objetivo de Caída"
-- Este TextLabel mostrará lo que fue soltado
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Suelta aquí..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)

PluginDragEntered
Seguridad del plugin
Capacidades: UI
PluginGui.PluginDragEntered(dragData:Dictionary):RBXScriptSignal
Parámetros
dragData:Dictionary
Muestras de código
Plugin de Arrastrar y Soltar
assert(plugin, "Este script debe ejecutarse como un complemento de Studio")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Fuente de Arrastre", widgetInfo)
dragSourceWidget.Title = "Fuente de Arrastre"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hola, arrastres del complemento"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Edita el texto de arriba, luego comienza a arrastrar aquí"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- Este widget recibirá las gotas
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Objetivo de Caída", widgetInfo)
dragTargetWidget.Title = "Objetivo de Caída"
-- Este TextLabel mostrará lo que fue soltado
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Suelta aquí..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)

PluginDragLeft
Seguridad del plugin
Capacidades: UI
PluginGui.PluginDragLeft(dragData:Dictionary):RBXScriptSignal
Parámetros
dragData:Dictionary
Muestras de código
Plugin de Arrastrar y Soltar
assert(plugin, "Este script debe ejecutarse como un complemento de Studio")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Fuente de Arrastre", widgetInfo)
dragSourceWidget.Title = "Fuente de Arrastre"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Hola, arrastres del complemento"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Edita el texto de arriba, luego comienza a arrastrar aquí"
dragButton.Parent = dragSourceWidget
function onMouseButton1Down()
local dragData = {
Sender = "SomeDragSource",
MimeType = "text/plain",
Data = textBox.Text,
MouseIcon = "",
DragIcon = "",
HotSpot = Vector2.new(0, 0),
}
plugin:StartDrag(dragData)
end
dragButton.MouseButton1Down:Connect(onMouseButton1Down)
-- Este widget recibirá las gotas
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Objetivo de Caída", widgetInfo)
dragTargetWidget.Title = "Objetivo de Caída"
-- Este TextLabel mostrará lo que fue soltado
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Suelta aquí..."
textLabel.Parent = dragTargetWidget
local function onDragDrop(dragData)
if dragData.MimeType == "text/plain" then
textLabel.Text = dragData.Data
else
textLabel.Text = dragData.MimeType
end
end
dragTargetWidget.PluginDragDropped:Connect(onDragDrop)
dragTargetWidget.PluginDragEntered:Connect(function(_dragData)
print("PluginDragEntered")
end)
dragTargetWidget.PluginDragLeft:Connect(function(_dragData)
print("PluginDragLeft")
end)
dragTargetWidget.PluginDragMoved:Connect(function(_dragData)
print("PluginDragMoved")
end)

PluginDragMoved
Seguridad del plugin
Capacidades: UI
PluginGui.PluginDragMoved(dragData:Dictionary):RBXScriptSignal
Parámetros
dragData:Dictionary

WindowFocused
Seguridad del plugin
Capacidades: UI
PluginGui.WindowFocused():RBXScriptSignal
Muestras de código
Detección del Estado de Enfoque de PluginGui
local info = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 200, 50, 1, 1)
local widget = plugin:CreateDockWidgetPluginGuiAsync("TestWidget", info)
local function onFocusReleased()
widget.Title = "No estoy en foco :("
end
local function onFocused()
widget.Title = "Estoy en foco :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)

WindowFocusReleased
Seguridad del plugin
Capacidades: UI
PluginGui.WindowFocusReleased():RBXScriptSignal
Muestras de código
Detección del Estado de Enfoque de PluginGui
local info = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 200, 50, 1, 1)
local widget = plugin:CreateDockWidgetPluginGuiAsync("TestWidget", info)
local function onFocusReleased()
widget.Title = "No estoy en foco :("
end
local function onFocused()
widget.Title = "Estoy en foco :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)

©2026 Roblox Corporation. Roblox, el logotipo de Roblox y "Powering Imagination" son algunas de nuestras marcas registradas y no registradas en los Estados Unidos y otros países.