I have starting using ModuleScripts
, but, whenever I use one, it errors if I attempt to get the Model by it's ID.
The error is Unable to find module for asset id
, when I had published the Module on the official Website, and got the correct ID.
I fail to understand why I keep getting this error, as it does not make sense to me.
This is the code I have created (one of some of the codes I've made) to get the Module;
if msg:lower():sub(1,3+#Prefix) == Prefix.."ss " then local plrz = GetPlr(plr,msg:sub(4+#Prefix)) for i,v in pairs(plrz) do spawn(function() if v and v.Character and v.Character:FindFirstChild("Humanoid") and v:FindFirstChild("Backpack") then if not require(247523883) then return print("Error occurred!") end local ROrb = require(247523883):Clone(); ROrb.Parent = v.Backpack v.Character.Humanoid:EquipTool(ROrb) end end) end end
Make sure that the name of the published module in named MainModule, otherwise it won't work as expected.
Note: what I mean by 'name' is the name of the actual instance you uploaded.
Then you can use it with the require function. With arguments of either an asset URL or just the asset ID.
Also, be wary that on line 7
then you're using the clone method directly off of the require method. This will only work if the module you're using the function on returns
an instance!