Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

1 comment

0

The GUI won't appear when I install the plugin! D:

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.