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

When I click on the GUI Plugin button, it won't work. Why it's not working?

Asked by 6 years ago

I have no idea why it isn't working, here's 2 scripts.

Plugin script:

local loaded = plugin:GetSetting("pluginHasLoaded")
local toolbar = plugin:CreateToolbar("Test")

if not loaded then
    print("Hello!")
end

local button = toolbar:CreateButton(
    "Click me!",
    "Can you click me please?",
    "http://www.roblox.com/asset/?id=145723965"
)

button.Click:connect(function()
    plugin:Activate(true)
    script.Parent.ScreenGui:Clone().Parent = game.CoreGui
end)

GUI Button script:


function click() print("Clicked!") end script.Parent.MouseButton1Click:connect(click)

Can you help me please? :/

2 answers

Log in to vote
0
Answered by
uhTeddy 101
6 years ago
Edited 6 years ago

You need to have it all in one script.

for instance:

local gui = Instance.new("Gui", game.CoreGui)
local frame1 = Instance.new("Frame", gui)
frame1.Position = UDim2.new(50,0,50,0)
local Button = Instance.new("TextButton", frame1)
Button.Position = UDim2.new(frame1.Position)

Now under that you need to enter your functions

Button.MouseButton1Down:connect(function()
 -- Functions
end)

This is just an example and positions, colors, size ect. won't be added.

0
The GUI won't appear when I install the plugin! D: KetchupRBLX 0 — 6y
Ad
Log in to vote
0
Answered by 4 years ago

Old question but it bothers me when the only reference to a problem I had, has no solution. I was able to resolve this issue by waiting for the GUI in core with:

game.CoreGui.ChildAdded:Connect(function(child)
    -- need to use WaitForChild as descendants may not have replicated yet
    --local head = child:WaitForChild("Head")
     --guiLocation.ClickerWindow.Frame.TextButton.MouseButton1Click:Connect(insertClickEvent)
end)

Answer this question