Cyclic dependency issue

FindFirstChild will try to find the Instance if it doesn’t find it will display nil but WaitForChild will give a warning if it doesn’t find the Instance.

But the problem is much deeper than FindFirstChild and WaitForChild

:WaitForChild() will yield your code untill it finds it
they serve different purposes

That is indeed right it’s just that I have to know the difference between the use case

If you know something MUST be there; use WaitForChild()
If there MAY be something in there; use FindFirstChild() or WaitForChild(name, timeout)

I have to learn about MediatorPattern at this point

Its not you’re just using it wrong. Its only useful if you know it already exists within the game. WFC is used to look for something but to wait for it to exist then continue,

Flip this, this isn’t right. You use waitforchild if you know something is going to be there, you use ffc for if you know it must be there.

Your literally over thinking this. Just merge the modules or use one over the other or just have a script do the handling instead and don’t have them import each other.

Very simple solutions but you don’t seem to be using them.

1 Like

Untrue;

It also depends on the script context

If its the client and you need an instance, it may not be there the moment you try accessing it
This is where you use :WaitForChild() AKA. The object WILL and MUST be there

You want to use :FindFirstChild() in the context if “There might be something here”, for example checking if a player has a certain tool AKA the object MAY be there

2 Likes

I guess you could do this but I havent really had to do this.

Love this discussion man lol :fire:

Anyway your problem is that you depend on both modules in each script

This kinda sucks to solve
You either have to make them not depend on each other or do some wacky task.defering which would loose the autocomplete

I finally decided to dump it all in one GameMode for the moment at this point was tired of overthinking so I can always change the architecture later on