Apprendre
Classe de moteur
PluginGui
Création impossible
Non répliqué

*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.



Référence API
Propriétés
Title
Lecture parallèle
Capacités : UI
PluginGui.Title:string

Méthodes
BindToClose
Capacités : UI
PluginGui:BindToClose(function:function):()
Paramètres
function:function
Valeur par défaut : "nil"
Retours
()

GetRelativeMousePosition
Sécurité des plugins
Capacités : UI
PluginGui:GetRelativeMousePosition():Vector2
Retours
Échantillons de code
PluginGui:GetRelativeMousePosition
local RunService = game:GetService("RunService")
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
false, -- État activé, substituer
200,
300, -- Taille
150,
150 -- Taille minimale
)
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()

Événements
PluginDragDropped
Sécurité des plugins
Capacités : UI
PluginGui.PluginDragDropped(dragData:Dictionary):RBXScriptSignal
Paramètres
dragData:Dictionary
Échantillons de code
Plugin Glisser-Déposer
assert(plugin, "Ce script doit être exécuté en tant que plugin du Studio")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Source de glisser", widgetInfo)
dragSourceWidget.Title = "Source de glisser"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Bonjour, glissements de plugin"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Modifiez le texte ci-dessus, puis commencez à glisser ici"
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)
-- Ce widget recevra les dépôts
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Cible de dépôt", widgetInfo)
dragTargetWidget.Title = "Cible de dépôt"
-- Ce TextLabel affichera ce qui a été déposé
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Déposez ici..."
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
Sécurité des plugins
Capacités : UI
PluginGui.PluginDragEntered(dragData:Dictionary):RBXScriptSignal
Paramètres
dragData:Dictionary
Échantillons de code
Plugin Glisser-Déposer
assert(plugin, "Ce script doit être exécuté en tant que plugin du Studio")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Source de glisser", widgetInfo)
dragSourceWidget.Title = "Source de glisser"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Bonjour, glissements de plugin"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Modifiez le texte ci-dessus, puis commencez à glisser ici"
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)
-- Ce widget recevra les dépôts
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Cible de dépôt", widgetInfo)
dragTargetWidget.Title = "Cible de dépôt"
-- Ce TextLabel affichera ce qui a été déposé
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Déposez ici..."
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
Sécurité des plugins
Capacités : UI
PluginGui.PluginDragLeft(dragData:Dictionary):RBXScriptSignal
Paramètres
dragData:Dictionary
Échantillons de code
Plugin Glisser-Déposer
assert(plugin, "Ce script doit être exécuté en tant que plugin du Studio")
local widgetInfo = DockWidgetPluginGuiInfo.new(Enum.InitialDockState.Float, true, true, 300, 200)
local dragSourceWidget = plugin:CreateDockWidgetPluginGuiAsync("Source de glisser", widgetInfo)
dragSourceWidget.Title = "Source de glisser"
local textBox = Instance.new("TextBox")
textBox.Parent = dragSourceWidget
textBox.Size = UDim2.new(1, 0, 0, 32)
textBox.Text = "Bonjour, glissements de plugin"
local dragButton = Instance.new("TextButton")
dragButton.Size = UDim2.new(1, 0, 1, -32)
dragButton.Position = UDim2.new(0, 0, 0, 32)
dragButton.Text = "Modifiez le texte ci-dessus, puis commencez à glisser ici"
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)
-- Ce widget recevra les dépôts
local dragTargetWidget = plugin:CreateDockWidgetPluginGuiAsync("Cible de dépôt", widgetInfo)
dragTargetWidget.Title = "Cible de dépôt"
-- Ce TextLabel affichera ce qui a été déposé
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Text = "Déposez ici..."
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
Sécurité des plugins
Capacités : UI
PluginGui.PluginDragMoved(dragData:Dictionary):RBXScriptSignal
Paramètres
dragData:Dictionary

WindowFocused
Sécurité des plugins
Capacités : UI
PluginGui.WindowFocused():RBXScriptSignal
Échantillons de code
État de la mise au point du 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 = "Je ne suis pas en focus :("
end
local function onFocused()
widget.Title = "Je suis en focus :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)

WindowFocusReleased
Sécurité des plugins
Capacités : UI
PluginGui.WindowFocusReleased():RBXScriptSignal
Échantillons de code
État de la mise au point du 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 = "Je ne suis pas en focus :("
end
local function onFocused()
widget.Title = "Je suis en focus :D"
end
widget.WindowFocusReleased:Connect(onFocusReleased)
widget.WindowFocused:Connect(onFocused)

©2026 Société Roblox. Roblox, le logo Roblox et Powering Imagination font partie de nos marques déposées aux États-Unis et dans d'autres pays.