Can I make a button from a Frame?

I really don’t like the default Roblox buttons. Even when you are making them invisible, they still show a ‘pointing’ cursor when moving over them, and they have enter and exit issues.

So I thought, I would make my own buttons using Frames, since they inherit from GuiObject.

However, when I click on a Frame, and detect UserInputService InputBegin, the guiprocessed is never set to true.

So is there a way to make a button from a frame, and have it understand that when its clicked, that should absorb the mouse click and so the system should set guiprocessed to true?

Thanks.

Did you try the Frame.InputBegan event?

Yeah, its weird, if I have 2 frames that overlap, and each one is detecting Frame.InputBegin, when clicking where they overlap, they both fire the event, and the gameProcessedEvent: [bool] will print out to ‘nil’ , I would expect a ‘true’ or ‘false’ , and was hoping the top frame would give ‘false’ and the bottom frame would give ‘true’ so my code would only consider the top one clicked.

You gotta remember your so called “guiprocessed” has nothing to do with your own processing but rather core scripts processing

I thought if you had this enabled it would…

image

Oh… that’s quite weird :thinking:


What about listening using normal UserInputService, then calling PlayerGui:GetGuiObjectsAtPosition, and as they said:

Takes a screen position and returns a list of all the GuiObject instances that are occupying that screen position, sorted in the order they appear on-screen from top to bottom as the first and last index, respectively.

that means simply using the first item in that returned table (if it does exist) should be enough, shouldn’t it?

I had not ever heard of GetGuiObjectsAtPosition. So this should give me enough tools to sort of make my own custom button system, considering the result are in order.

I did look at the gameprocessed in the InputBegin event, and oddly enough it was ‘true’, so clicking on frames with ‘Active’ turned ‘on’ will trigger a true response with UserInputService’s events, but not with GuiObject’s events.

Another instance of Roblox being at its peak! At least you have something else to you use now, lol.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.