I’m looking to preload a module exclusively on the server, but I’m not sure how to do so. I’ve looked up solutions on the DevForum, but I’m yet to find anything.
example: 1936396537 > DataStore2
I’m looking to preload a module exclusively on the server, but I’m not sure how to do so. I’ve looked up solutions on the DevForum, but I’m yet to find anything.
example: 1936396537 > DataStore2
If you’re trying to load a module you can simply do:
require(1936396537) --which will load the asset IF it's ModuleScript AND named "MainModule"
Or you can use something like this with InsertService:
local ID = 1936396537
local InsertService = game:GetService("InsertService")
local s, item = pcall(InsertService.LoadAsset, InsertService, ID)
if s and item then
item.Parent = game.ServerStorage --parent the item wherever you need it.
end
If you don’t understand you can view the API Reference here:
If you have any further questions feel free to ask!
Would this load before a player joins the server?
If you have this located within a server script, yes, it will load upon server creation!