Strange problem

I wanted do one thing but bruh, thing which i used before for me now broked
Module script:

local MODULE = {
	"test"
}
return MODULE

Console script:

local test = require(game.StarterGui.CoreScripts.test) print(#test)

And console says its just zero without any errors, but its not zero

2 Likes

One method:

--Module Script

local MODULE = {
	["test"] = "test123"
}
return MODULE


-- Local Script
local test = require(game.StarterGui.CoreScripts.test)
print(test["Test"]) --> prints "test123"

The other method:

-- Module Script
return function()
     return "test123"
end

-- Local Script
local test = require(game.StarterGui.CoreScripts.test)
print(test())   --> prints "test123"

That is weird, seems to work fine for me. Try restarting your studios, or perhaps rewriting the Lines. I know Roblox can be buggy like that some times, and it’s not uncommon for IDEs to return incorrect values some times.

I just understand i can do like just

local MODULE = 
{
test = "a"
}
print(require(game.StarterGui.CoreScripts.Test).test)

and this will print β€œa”