Hey Dev Forum,
I was wondering how I may a module to require for a group that I dev for.
The thing that is different about the module though, is that the module needs to load a different module script depending on the placeID. And, it ONLY loads the module script.
Thanks for your help,
Sasial.
If that’s too hard. How do you make a module for a group?
You can check the placeId via the game.PlaceId
.
In this example, for placeId 12345 you want Module1 to be required, and for placeId 12346 you want Module2 to be required.
--Single module script
local data = {
12345 = script:WaitForChild('Module1')
12346 = script:WaitForChild('Module2')
}
return require(data[game.PlaceId])
Basically, we return the required module based on the place id.
Thank you!
Do you know of any tutorials on how to create a module?
To all who are doing something like this, follow post #3. This is my modified code:
local data = {
P2348275489 = script:WaitForChild('IC'),
P2813645031 = script:WaitForChild('EC'),
P3306170420 = script:WaitForChild('TC')
}
local pid = game.PlaceId
return require(data["P"..pid])
Issue:
12:00:07.326 - require(assetId) cannot be called from a client
Yes, I know what it means.
The thing is, I’m calling from a server script.
(Basic Admin Essentials Loader, as I have made a custom loader using the open source code.)
No. I’m not.
Strange, isn’t it?
Let me open ROBLOX studio.
I’ll give you a screenshot of the output.