Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting a value from a module script ?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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
0
Thanks ! xJathur95x 129 — 6y
Ad

Answer this question