require(ID) not working in a local script

Hello everyone! I am trying to require a module in a local script, but it gives me an error that says I’m unable to do that. I’ve tried requiring the module from a server script and sending it to the client via remote events, but weirdly it does not run the functions. The error says they’re nil. Does anyone know the cause of this and possibly any solutions? Thanks!

it can be that the ModuleScript is in a place where the LocalScript cannot access it, such as all the things like ‘ServerStorage, ServerScriptStorage’ etc. where are you putting this ModuleScript? if it is in one of these places, you’ll need to put it in somewhere where it can be accessed by LocalScripts, like in ReplicatedStorage.

1 Like

(also this is the wrong channel for asking this, change it to Help and Feedback, Scripting Support just incase a mod sees this post and punishes you for it)

Hello! I get the same error when I try this.


By the way, this is using an ID for the require.

It’s in the documentation: ModuleScript. LocalScripts aren’t allowed to require by id. I’m not sure how you’re sending things over through remotes nor how it works but trying to send over an entire system ModuleScript through a remote is just bad practice outright.

The easy answer here is just not to require by id. If you really need this accessible across multiple places in your experience then use Packages instead. Granted, since you haven’t provided a use case in the OP, it’s hard to understand what you’re trying to accomplish and why you can’t just have your ModuleScript in the DataModel itself accessible in a container that replicates to the client.

3 Likes

Do you own the item ID?

If you try to require(ID) an ID that isn’t yours it wont require i

Hello! Package links are actually better for what I’m doing! Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.