Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Where to connect GUI button clicks in plugins? [SOLVED] [closed]

Asked by 10 years ago

Fixed it, I could connect the events to where I thought they would be originally.

Hi everyone, I am trying to improve my script converter plugin by making it simple and using GUIs. I know how to clone the GUI so it's visible on screen, but I am stuck on how I can execute button click events for GUI objects in a plugin.

I have only one idea where the event connections would go but I want to confirm that this is the right way to go about this before I do so.

Plugin button click script (part of my plugin's script):

local open = false
local button = toolbar:CreateButton(
    "Conversion GUI",
    "Make sure you've selected your scripts.",
    ""
)

button.Click:connect(function()
    if game.StarterGui:FindFirstChild("ConvertGui") then
        game.StarterGui.ConvertGui:Destroy()
        print("Conversion GUI closed")
        open = false
    else
        local CGui = script.ConvertGui:Clone()
        CGui.Parent = game.StarterGui
        print("Conversion GUI opened")
        open = true
        --Should GUI button click event connections go here, on in the GUI itself?
    end
end)

Any help is appreciated, thanks!

Locked by Spongocardo, adark, and 1waffle1

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?