Why is WaitForChild() not working?

Screenshot 2023-08-28 180105
Screenshot 2023-08-28 180115

What is going on? Why is WaitForChild() yielding when it is in the right directory?

1 Like

Could be it’s not fully loaded yet. A well placed task.wait(3) may fix this.

2 Likes

StarterGui is the place it’s located, but I’m guessing you are looking for it (in the script) inside the player.
If so you need to reference the player, then mainGui.
Also remember that the player in game isn’t in the Player section, it’s in the workspace and inside the player there.

If you’ve already done this then please put your entire script here. Just one line won’t tell us how you’ve used that line in the script.

1 Like

image

The entire scripts would be fairly chunky, but if you think that extra context is needed then I will paste them. To understand, the referenceModule is a module script that is required and then put into the _G table. the second screenshot is part of the referenceModule, and includes getting the player, waiting for PlayerGui and then waiting for MainGui

1 Like

When testing look inside your Player to see if the ButtonsFrame is actually there when the player loads in.
If it is then you have to find out why the waitforchild isn’t working. Maybe it’s one of the last things loaded into the game and the script times out?

oh boy this is going to be a long day

image

1 Like

I forgot to set the ResetOnSpawn property in the gui to false :man_facepalming:t6:

2 Likes

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