Plugin Can't Find Any Children

So, I’m trying to create my first plugin.

For some reason, the plugin cannot find any of the children of the script when using WaitForChild().

So, I put a part (lines 3-7 of the script) to check the children.

On line 30, you can see that WaitForChild fails.

image

Why can it not find the children, even when using WaitForChild?

(I right-click on CreatePoints and save it as a Local plugin).

I tried parenting everything in the plugin to MouseHitP and then switching everything to find the children, but it also can’t find any children.

3 Likes

This is odd… I just wrote a test plugin using the same code you showed and I get the children fine. Could you upload a little more of the script (use the Preformatted Text Option with ``` surrounding the code instead of screenshots). Specifically I’m wondering what the line that calls :WaitForChild("TwoPoints") looks like.

It’s fine, I found out that when saving the plugin, you also have to select the children.

image

1 Like

Ok good. Another way to structure a plugin is by putting it all in a Folder. For example:
PluginExampleStructure
I believe the script (and it has to be a Script) that you would like to run as the main script of the plugin must be named PluginScript. However I could be wrong. I’m able to simply right click the top-level folder and select Save As Local Plugin using this setup (without having to select all the children too). But however you would like and works for you is good too!

3 Likes