How do I fix this error?

I keep getting this error which is breaking multiple scripts that are essential for the game I develop for.

This is the error:

The line of code it is referencing:


(It can either be line 152, or line 153.)

Since I don’t really have that much scripting knowledge on these complicated modules, I’d really like some help in fixing this.

Make sure the instance exists to be able to use FindFirstChild on it

if InstanceParent and InstanceParent:FindFirstChild(InstanceName) then

Line 155 now errors.

Try doing

if InstanceParent then
    if InstanceParent:FindFirstChild(InstanceName) then
        SearchInstance = InstanceParent[InstanceName]

Unfortunately, doing this just breaks everything.

If it won’t fix, you have to make sure InstanceParent exists before calling the function.

What code are you using to call the module (and to fire the functions in the module)

Well it’s definitely code I mostly don’t understand, and some of these are pretty complicated, atleast for me.

This is the first line of code that errors because the module doesn’t work.
image

2/4

3/4
image

4/4
image