Using an utility module for plugins

I made a set of plugins that all use an utility module. I get the module by id:

local util = require(id)

While this works fine in studio edit mode, when you test the game, you get an error:
require(assetId) cannot be called from a client.

To work around this, I just made it so code for the plugin doesnt run if RunService:IsClient(). Of course that means that none of my plugins work on the client when testing, but they do on the server.

How could I work around this so it works on both the client and server?

When first loading the plugin you can “copy” the module and put it in the game, then once the module exists in the place just require the module Instance instead of the id

1 Like