Module Scripts Not Working In Studio

Hello; I have recently made a script that randomly generates trees. The script is set up so that it has a ModuleScript with a function to make the tree, with a Vector3 position as the only parameter.

Using the command line, I try to run the module to set up some trees, and I get the following error:
image

However, when I run the exact same command in a ServerScript, and run the game, it generates the trees properly.

Also, I tried requiring a plain module script with only 1 function and then running it; It worked fine, with the command line (It printed out what it was supposed to).

[COMMAND]:
local m = require(workspace.ModuleScript); m.Printout()
[MODULE]:
image

Why is this not working as it should???

Did you call a nil value in one of your events? eg. script.Parent.Touched:Connect() but you didn’t put anything in the brackets.

I don’t think so; Keep in mind that the exact same command worked when placed in a Server Script.

1 Like

Are you sure? Somewhere along your code, you’ve tried to call something that doesn’t exist. If that’s not it then I am stumped.

Have you previously required this script with the command bar? If so, it’s using a stale copy, and you can fix it by just cutting and pasting the module back into the game, and trying again from the command bar.

Either that, or check you’ve got no spelling errors (capitalisation, typos, etc.)

1 Like

I see workspace.TreeModule rather than ModuleScript in the [COMMAND] part? The module is being seen as nil most likely.

I will look into that as a possibility, thank you.