[Solved] Need help with plugin scripting!

  1. What do you want to achieve? Keep it simple and clear!
    I have been trying to make a simple plugin for my team and I to use for “easier building” that will allow us to easily scatter environment features across the map. It will be used to automate the process of decorating to make decorating easier.

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that I can’t seem to get children in my script and I can’t even parent a UI from a model to it, or using the assets folder.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried looking for solutions, but couldn’t find any, so please link me to a question with an answer that answers my question or answer it yourself!

local ToolBarButton = plugin:CreateToolbar("Environment Tool"):CreateButton("EnvironmentTool", "Click here to get started!", "rbxassetid://4850193445")

local Toggle = false

	local WidgetInfo = DockWidgetPluginGuiInfo.new(
		Enum.InitialDockState.Left,  -- Widget will be initialized in floating panel
		false,   -- Widget will be initially enabled
		false,  -- Don't override the previous enabled state
		125,    -- Default width of the floating window
		175,    -- Default height of the floating window
		125,    -- Minimum width of the floating window (optional)
		175     -- Minimum height of the floating window (optional)
	)
	
	local UI = plugin:CreateDockWidgetPluginGui("PluginUI", WidgetInfo)
	UI.Title = "Environment Tool"
	local PluginUI = require("rbxassetid://4850530077")
	PluginUI.Parent = UI

function ToggleButton()
	ToolBarButton:SetActive(not Toggle)
	UI.Enabled = not Toggle
	Toggle = not Toggle
end

function StartSelection()
	local Cursor = Instance.new("Part")
	Cursor.Color = 
	plugin:Activate(true)
	local Mouse = plugin:GetMouse()
	
end
	
function StopSelection()
	
end
	
function UpdateSelection()
		
end
	
function PlaceModels(Models)
		
end
	
CreateUI()

ToolBarButton.Click:Connect(Toggle)

It is all in one script that creates a dockwidgetplugingui and then parents a model’s UI contents to it.

1 Like

I throw all plugin children into a model/folder. (this model/folder is what you’ll upload as the plugin)

check out this picture below and then look at the code, and you’ll understand

local toolbar = plugin:CreateToolbar("ExamplePlugin")
local openButton = toolbar:CreateButton("Open","by codyorr4","rbxassetid://4818622346")
local p = script.Parent
local gui = p:WaitForChild("ScreenGui")
local coreGui = game:GetService("CoreGui")
local open=false

openButton.Click:Connect(function()
	if(open == false)then
		open=true
		gui.Enabled=true
		gui.Parent = coreGui
	else
		open=false
		gui.Enabled=false
		gui.Parent = nil
	end	
end)
2 Likes

Thats what I would do when uploading a plugin.

2 Likes

same, it took me awhile to figure out how to grab the plugin children, but I ended up figuring it out by accident lol.

also @DominusInfinitus don’t forget to parent your plugin GUI to the CoreGui.

2 Likes

Thanks for the help! Now it is working much better.

1 Like