I have a script in ReplicatedFirst I use to require stuff with. I tried ../../StarterPlayer/StarterPlayerScripts/services/AdminPanel
, but I get Unable to require module from given path
.
Unless you’re using certain libraries, that directory won’t work. You’d need to, for example, have Rojo, Darklua and Luau Language Server installed in your project and working properly. They can convert paths to Roblox hierarchies.
But I was told this was a new feature in the studio.
I haven’t heard about it, and I can’t find anything online either. Send me what you read
I read it on Hidden devs, but Roblox even has an error for it, so it is a thing. It says that the path need to start with “./” or “…/”.
It just looks like what a project set up with those 3 libraries looks like;
local module = require('../../@jsdotlua/luau-polyfill/src/init.lua')
What the …/…/ means is similar to how .Parent works in Roblox: it’s stepping upwards in the hierarchy. You can try make sure that your path makes sense. If you have your script as a child of your modulescript, you’d
require('../')
If they are both children of the same parent, it’s
require('../modulescript')
The script is in script.Parent.Parent.StarterPlayer.StarterPlayerScripts.services
, so I should have defined it right, right?
Yes, it looks to be okay. So it probably just isn’t a feature (yet). Roblox would have to automatically convert the string to a path, but I guess it isn’t doing that
Okay thank you.
Btw, I found this out.
I required the module from a a function called get() in another module in ReplicatedFirst, and the path then started at the script where I executed the get() function instead of the module in ReplicatedFirst.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.