TextButton events not working

We’ve been stuck over this issue for a few hours. We are getting the expected output that suggests that the correct button assets in the PlayerGui are being loaded, but however, the events attached to the buttons are not working. Worse of all, this is extremely inconsistent, with one of us having the buttons fail to work every time, and with the rest of our team having about a 25% chance of the buttons breaking.

Things that we have tried (and failed):
Deleting every other UI asset besides the buttons
Moving the buttons to the root of the ScreenGUI they are contained in for testing purposes
Making sure that the buttons are set to Active
Changing the zIndex value of the buttons
Attempted to load the character manually after using LoadCharacter

Console Output:

  Hello world!
  Found button
  Found button
  Found button

Relevant Code:

for _, button in pairs(UI.Home.baseFrame:WaitForChild("MainMenuHolder"):GetChildren()) do
	if button:IsA("TextButton") then 
		print("Found button")

There are absolutely no errors in the console.

why are y using InputBegan?

If you are running a team create did you commit the code? Are you sure you aren’t just missing the output? Are the buttons being removed at all or recreated? I just recreated this in a separate file and everything worked as expected. Is there a file you could upload? A few things could be causing this not to work.

Someone else used input began, and for the 83% of times that it worked, InputBegan worked fine. However, if that is your concern, note that the MouseButton1Click also does not work.

  1. Am I commiting the code?
    It shouldn’t matter for Play Solo (it’s a part of the collaborative programming that you don’t have to apply to test your personal changes,) but yes, I did test with applying. 4 people have been going at this issue for around ~7 hours.
  2. Missing the output?
    No. Most definitely not.
  3. Are the buttons being moved or recreated?
    I attached a spawned function to print the full name of the buttons each second. They are not moving, or changing at all. They remain in the same place.
  4. A few things could be causing this not to work:
    We are honestly unsure why this isn’t working at this current time. Interestingly, it only fails to function 83% of the time. (estimate)

Again, the buttons are being found and are staying in the same position, but the events just refuse to work.

When you mean “refused to work”, do you mean when you interacted with it, it didn’t fire? Is the local script enabled? Are you sure you are connecting it to the correct GuiButton?

I don’t really know. Here is the quick file i did (everything is in StarterGui. uitest.rbxl (20.7 KB)

All i can really think of is that the UI elements are getting deleted (thus disconnecting the events) and recreated causing them to still show up in the prior location just without the events firing.

Yes. Interacting with the button entirely fails, even though the same buttons that are being connected in the loop are the ones receiving the events. We’re getting some output, but not the entire output.

Is the script enabled? What is the hierarchy of "MainMenuHolder (It’s children, picture will be great)? Is there another script that deletes the GUI?

Again, the script is printing out the first lines (getfullname and found button,) but not listening to the clicks or anything else.

And where is the script located?

The script is located inside of the player, and again runs as intended up until interaction with the button begins. See the output posted from above.

If you relocate the script to the gui itself does it fix the problem?

The problem was due to how the had the UI parented. Apparently, whenever we had the UI parented to a ModuleScript at any point, the UI would refuse to work vehemently. We’ve literally done this exact same before and had it work 100% of the time totally fine. Thanks to @Brinker7 for helping us find this strange issue.