Type checking warning: "Unknow require: unsupported path"

I’ve gotten a type checking warning (with --!strict) in a server-script, stating the following:

As you can see, the modulescript does exist.

unsupportedpath-path

This seems to be purely with type checking, the code runs perfectly fine and finds the module without erroring.

try doing

local GameCoordinator = require(game.ServerStorage.GameCoordinator)

It’s nothing just ignore it. It’s a roblox script editor that doesn’t like modules for a reason. It wont break your code you can just leave it the way it is it wont give any errors in console so its fine.

Firstly try this before doing what I said.

While that gets rid of the orange underline, it’s not what I want. The underline appears if I use GetService, and I’m not sure if it’s a bug or a fault of my own.

This will answer your question if it still shows after doing what @instanitly said.

you didn’t make a variable for ServerStorage thats why its showing orange line

local ServerStorage = game:GetService("ServerStorage")

@Judgy_Oreo You need to put this under the local Players line

I have created a variable. It’s just something that’s bothering me, the fact that there’s an ugly orange line in my script when there’s nothing wrong, and the fact that it only appears when doing

local ServerStorage = game:GetService("ServerStorage")

But disappears if I do

local ServerStorage = game.ServerStorage

then you can use this

local ServerStorage = game.ServerStorage

they are just the same

1 Like

No, they’re kinda different.

Because :GetService creates the service if it dosent exist, that’s why : GetService is efficient

No, it doesn’t. GetService() is better because it gets the corresponding service even if you change the service’s name, not because it creates a new service or is more efficient. For example, if you change the name of the ReplicatedStorage to ClientStorage, doing game.ReplicatedStorage will error but doing game:GetService("ReplicatedStorage") will return the correct renamed service.

1 Like

image

No. It errors like it should.


It identifies a server despite a name change because by default the ClassName and Name for services like ReplicatedStorage are the same*, which leads to the behaviour @VegetationBush identified.

* some exemptions apply but these are legacy problems for unused services (i.e LuaWebService)

2 Likes

Just for clarification because this can be misunderstood, it does try to create initialize a service that doesn’t exist. That’s almost never why it is used, but it is a reason why it can be a good practice.

1 Like

Move the script to the ReplicatedStorage folder and try the following:

local Storage = game:GetService("ReplicatedStorage")
local GameCoordinator = require(Storage:WaitForChild("GameCoordinator"))

You can’t access the ServerStorage folder from a local script.

It’s in a server-script, and the problem is the typechecking, it does not error and functions correctly.

At this point I’m rather sure it’s some sort of type checking bug. Hopefully someone with permissions to post in #bug-reports or use the bug report wizard sees this and reports it to Roblox.

This typechecking bug appears to have been fixed, I’m not sure what caused it, but, if you encounter one similar to this, make a new thread/post about it.

It’s still a thing
image

local require = require
require(v)

this was a solution though

2 Likes

The specific scenario I had it in was fixed and is still fixed as far as I can tell:

local ServerStorage = game:GetService("ServerStorage")

-- There USED to be a "Unknown require: unsupported part" warning here
local MyModule = require(ServerStorage.MyModule)

The warning still occurs when dynamically requiring modules, but that’s a separate problem and not nearly as annoying as the bug originally reported:

local MyModules = ModuleScripts:GetChildren()
local Modules = {}

for _, ModuleScript:ModuleScript in MyModules do
    -- The "Unknown require" warning occurs here RIGHT NOW.
    -- This is because Luau can't know what the ModuleScript is without looking
    -- at the MyModules Folder, which it doesn't have access to.
    Modules[ModuleScript.Name] = require(ModuleScript)
end
4 Likes