Why is my function receiving the contents of my module and not the passed value?

Hi!

I’m rather confused here.
There’s nothing much to say other than that I have no clue as to why this is happening.
So, what am I doing?

I call LookAtTarget and pass in an object value (Ignore space above my temp function)

image

My module receives this request, but for some reason, "target" is now a TABLE! ..So I iterate over it and print it's contents..

This is the result..

image

I have two questions:

  • WHY
  • HOW

I never knew this was even possible.
Thank you in advance.

1 Like

image

Red arrow points to how you’re calling the module function.

Blue arrow points to how you’ve declared the module function.

You’re calling it as a method, meaning you’re passing the entire module as the first parameter, since you’re declaring it with ‘.’.

Fix:

change the red arrow line to:

leanMethods.LookAtTarget(workspace.World.NPCS.Dummy.Trigger)

OR

change the blue arrow line to:

function module:LookAtTarget(target)
1 Like

I noticed the same thing RIGHT after I made this post.
I’ll give you the solution for taking your time, so thanks!

Honestly, I keep embarrassing my self by making stupid mistakes and then asking people why, haha.
I hope this post helps people in the future who make the same oversight.

1 Like

No worries. I’m sure it will help somebody.

The hardest part about learning this type of thing is learning how to properly debug, and to look for simple common mistakes - which just comes with time.

1 Like