Attempt to index boolean with click

I’m making a plugin with coregui ui, when i try to make a button clickable (button.Click:Connect(function()) it gives an error that says (attempt to index boolean with ‘Click’)

xasddsdascxzc

local gui = Sourced.Tool 
local hide = gui.Hide
hide.Click:Connect(function() print("Hide") 	 end) 


Any assistance is appreciated

i think it’s seeing “Hide” as a property of Tool, rather than as a child.
Consider doing

local hide = gui["Hide"]

instead, and see if it fixes your issue

You are saying that there is a hide property in the ScreenGUI? That’s awkward since I only know the property Visibility. It is not even listed in the documentation.

It’s the only explanation I can think of as to why it would be giving a boolean instead of an object. If you’ve got other explanations, go ahead and say it.
While I’m also not aware of any property “hide” in it, there have been deprecated properties which are not usually visible, and “hide” could be a likely one of GUi objects.

1 Like

I am pretty sure you need to do:

hide.MouseButton1Click:Connect(function() print("Hide")  end)

I am not to sure but I don’t think Click is a vaild property of a button. What I do is make it MouseButton1Click and it works fine.

3 Likes

You are so right! Even the documentation proves it!

it works!, there’s boolean and gui name with same variable, thanks

1 Like

No problem!