-- Miryx Studio Bridge — official Studio-side test helper -- Install: Roblox Studio > Plugins > Manage Plugins > Create New Plugin, then paste this file. -- This plugin stages the selected Script/LocalScript/ModuleScript for a real local Play test. -- It never publishes a place or runs the test automatically: the developer must press Play. local Selection = game:GetService("Selection") local ServerScriptService = game:GetService("ServerScriptService") local StarterPlayer = game:GetService("StarterPlayer") local LogService = game:GetService("LogService") local ChangeHistoryService = game:GetService("ChangeHistoryService") local toolbar = plugin:CreateToolbar("Miryx") local toggleButton = toolbar:CreateButton( "MiryxStudioBridge", "Open Miryx Studio Bridge — stage selected code for a local Play test", "rbxassetid://4458901886", "Miryx Studio" ) toggleButton.ClickableWhenViewportHidden = true local widgetInfo = DockWidgetPluginGuiInfo.new( Enum.InitialDockState.Right, false, false, 380, 500, 320, 380 ) local widget = plugin:CreateDockWidgetPluginGui("MiryxStudioBridge", widgetInfo) widget.Title = "Miryx Studio Bridge" local root = Instance.new("Frame") root.Name = "Root" root.Size = UDim2.fromScale(1, 1) root.BackgroundColor3 = Color3.fromRGB(12, 17, 26) root.BorderSizePixel = 0 root.Parent = widget local padding = Instance.new("UIPadding") padding.PaddingTop = UDim.new(0, 14) padding.PaddingBottom = UDim.new(0, 14) padding.PaddingLeft = UDim.new(0, 14) padding.PaddingRight = UDim.new(0, 14) padding.Parent = root local layout = Instance.new("UIListLayout") layout.Padding = UDim.new(0, 10) layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Parent = root local function label(text, height, order) local item = Instance.new("TextLabel") item.Size = UDim2.new(1, 0, 0, height) item.BackgroundTransparency = 1 item.TextColor3 = Color3.fromRGB(226, 235, 246) item.TextWrapped = true item.TextXAlignment = Enum.TextXAlignment.Left item.TextYAlignment = Enum.TextYAlignment.Center item.Font = Enum.Font.Gotham item.TextSize = 13 item.Text = text item.LayoutOrder = order item.Parent = root return item end local function button(text, order) local item = Instance.new("TextButton") item.Size = UDim2.new(1, 0, 0, 38) item.BackgroundColor3 = Color3.fromRGB(116, 225, 180) item.TextColor3 = Color3.fromRGB(7, 20, 15) item.Font = Enum.Font.GothamBold item.TextSize = 13 item.Text = text item.LayoutOrder = order item.Parent = root local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = item return item end label("MIRYX / ROBLOX STUDIO", 26, 1).Font = Enum.Font.GothamBold label("Sélectionne un Script, LocalScript ou ModuleScript dans l’Explorer. Le pont prépare un exemplaire de test dans le bon conteneur Studio.", 54, 2) local selectionLabel = label("Sélection : aucune", 38, 3) local statusLabel = label("État : prêt. Le test réel démarre uniquement lorsque tu appuies sur Play dans Studio.", 52, 4) local prepareButton = button("Préparer un test Play local", 5) local cleanupButton = button("Nettoyer les éléments de test", 6) local warningLabel = label("Sécurité : utilise Play / Start Server en local. N’exécute pas de script non fiable. Le code peut modifier ton monde de test. Ne publie jamais un test avant revue.", 68, 7) warningLabel.TextColor3 = Color3.fromRGB(255, 194, 135) local staged = {} local lastSelected = nil local function isSource(instance) return instance and instance:IsA("LuaSourceContainer") end local function refreshSelection() local items = Selection:Get() lastSelected = nil for _, item in ipairs(items) do if isSource(item) then lastSelected = item break end end if lastSelected then local ok, source = pcall(function() return lastSelected.Source end) if ok then selectionLabel.Text = string.format( "Sélection : %s (%s) · %d caractères", lastSelected:GetFullName(), lastSelected.ClassName, #source ) else selectionLabel.Text = "Sélection détectée, mais Source inaccessible." end else selectionLabel.Text = "Sélection : aucune source Luau reconnue." end end Selection.SelectionChanged:Connect(refreshSelection) local function pathExpression(instance) local chain = {} local current = instance while current and current ~= game do table.insert(chain, 1, current) current = current.Parent end local expression = "game" for _, part in ipairs(chain) do if part.Parent == game then expression = expression .. ":GetService(" .. string.format("%q", part.Name) .. ")" else expression = expression .. ":WaitForChild(" .. string.format("%q", part.Name) .. ")" end end return expression end local function stageSelected() refreshSelection() if not lastSelected then statusLabel.Text = "État : sélectionne d’abord un Script, LocalScript ou ModuleScript." return end local ok, source = pcall(function() return lastSelected.Source end) if not ok or type(source) ~= "string" or #source < 1 then statusLabel.Text = "État : impossible de lire Source ou le script est vide." return end local stagedInstance local safeName = "Miryx_Test_" .. string.gsub(lastSelected.Name, "[^%w_]", "_") if lastSelected:IsA("Script") then stagedInstance = lastSelected:Clone() stagedInstance.Name = safeName stagedInstance.Disabled = false stagedInstance.Parent = ServerScriptService elseif lastSelected:IsA("LocalScript") then stagedInstance = lastSelected:Clone() stagedInstance.Name = safeName stagedInstance.Disabled = false stagedInstance.Parent = StarterPlayer:WaitForChild("StarterPlayerScripts") elseif lastSelected:IsA("ModuleScript") then local runner = Instance.new("Script") runner.Name = safeName .. "_Runner" local targetExpression = pathExpression(lastSelected) runner.Source = table.concat({ "-- Generated by Miryx Studio Bridge. Runs only when Studio Play starts.", "local target = " .. targetExpression, "local ok, result = pcall(require, target)", "if ok then", " print('[MIRYX_STUDIO_TEST] MODULE_REQUIRE_OK ' .. target:GetFullName())", "else", " warn('[MIRYX_STUDIO_TEST] MODULE_REQUIRE_FAILED ' .. tostring(result))", "end", }, "\n") runner.Parent = ServerScriptService stagedInstance = runner end if stagedInstance then table.insert(staged, stagedInstance) ChangeHistoryService:SetWaypoint("Miryx Studio test staged") statusLabel.Text = "État : test préparé. Appuie maintenant sur Play dans Studio pour exécuter le code dans le runtime Roblox local. Les résultats apparaîtront dans Output." end end local function cleanup() local removed = 0 for _, instance in ipairs(staged) do if instance and instance.Parent then instance:Destroy() removed += 1 end end table.clear(staged) ChangeHistoryService:SetWaypoint("Miryx Studio test cleanup") statusLabel.Text = "État : " .. tostring(removed) .. " élément(s) de test supprimé(s)." end prepareButton.Activated:Connect(stageSelected) cleanupButton.Activated:Connect(cleanup) LogService.MessageOut:Connect(function(message, messageType) if string.find(message, "%[MIRYX_STUDIO_TEST%]") then statusLabel.Text = "Résultat Studio : " .. string.sub(message, 1, 220) if messageType == Enum.MessageType.MessageError then statusLabel.TextColor3 = Color3.fromRGB(255, 130, 130) else statusLabel.TextColor3 = Color3.fromRGB(116, 225, 180) end end end) toggleButton.Click:Connect(function() widget.Enabled = not widget.Enabled refreshSelection() end) refreshSelection()