Gui buttons not firing code in my plugin

I am very new to making plugins, and I would be very grateful for any assistance. I am encountering a problem where MouseButton1Click listeners are not working for the buttons in the GUI I made (which I put in CoreGui).

This code is inside a function that is fired by a plugin toolbar button:

gui = script:WaitForChild("pluginGui")
gui.Parent = game:GetService("CoreGui")

gui.Button.MouseButton1Click:Connect(function()
  print("Do stuff here")
end)

I am not getting anything of note in the output. Any help would be appreciated.

1 Like