Help with Plugin Creation

  1. What do you want to achieve? I’m trying to make a plugin that when activated creates a dock window with clickable buttons.

  2. What is the issue? Whenever I save it as a local plugin it errors with this message:
    lua 11:05:47.667 Clicked is not a valid member of PluginToolbarButton "Instance" - Edit

  3. What solutions have you tried so far? Watching tutorials and browsing roblox scripting websites.

open = false
railcount = 0
local name = "Train Plugin"
local toolbar = plugin:CreateToolbar(name)
local text = "TrainSetup"
local tooltip = "Train Setup"
local iconName = "http://www.roblox.com/asset/?id=6886426156"
local button = toolbar:CreateButton(text,tooltip,iconName)

button.Clicked:Connect(function()
	if open == false then
		open = true
		local widgetInfo = DockWidgetPluginGuiInfo.new(
			Enum.InitialDockState.Float, 
			true,   
			false,  
			200,    
			300,    
			150,    
			150     
		)

	
		local testWidget = plugin:CreateDockWidgetPluginGui("TestWidget", widgetInfo)
		testWidget.Title = "Train System Setup"  
		
		local testButton = Instance.new("TextButton")
		testButton.BorderSizePixel = 0
		testButton.TextSize = 20
		testButton.TextColor3 = Color3.new(1,0.2,0.4)
		testButton.AnchorPoint = Vector2.new(0.5,0.5)
		testButton.Size = UDim2.new(1,0,1,0)
		testButton.Position = UDim2.new(0.5,0,0.5,0)
		testButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
		testButton.Text = "New Rail"
		testButton.Parent = testWidget
	else
		open = false
		
	end
end)


It’s Click, not Clicked.
Edit: Realized I posted to a 21 day old post, somebody probably edited their post in here

Hey, thanks for the reply anyways!