Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Getting a value from a module script ?

Everything is in the title,

So im trying to get a value from a modulescript but i have a trouble..

--Script in modulescript
local Jathur = {}

function Jathur.new()
	IsArmored = true,
	CanAttack = true
 }

return Jathur   

local Jathur = require(script.Parent)

if Jathur.Values.CanAttack == true then
	-- do stuff
end

I just want to know if it's possible

1 answer

✓ Accepted answer

Use dictionary, and here's the solution

local Settings = {
	['IsArmored'] = true;
	['CanAttack'] = true
}
local Jathur = require(script.Parent)

for i,v in pairs(Jathur.Settings) do
	if v.CanAttack then
	-- do stuff
	end
end

1 comment

0

Thanks !

This discussion is preserved as it was. New answers, comments, and votes are closed.