I’m trying to look for a variable’s value in a module, heres a snippet of my code to explain what I mean.
So, I’m trying to look for the ID of a block the player inputs. So when this function is called, it will search the BlockIDs module to find the ID of the block we input.
For example, if I inputted BlockID.BLOCK_AIR, it would print “0” because in the BlockID module, BLOCK_AIR = 0
But, instead of searching for what it’s supposed to, it’s searching for the variable called “ID” instead of the actual one.
local placement = {}
local blocks = require(script.Parent.Blocks)
local blockIDs = require(script.Parent.BlockIDs)
function placement.setBlockProperties(ID)
local block = blocks[blockIDs.ID]
print(block)
end
return placement
I don’t want it to search for “ID,” as that’s just a variable for what the player inputted, which may be BLOCK_AIR
local placement = {}
local blocks = require(script.Parent.Blocks)
local blockIDs = require(script.Parent.BlockIDs)
function placement.setBlockProperties(ID)
local block = blocks[blockIDs[ID]]
print(block)
end
return placement
local placement = {}
local blockIDs = require(script.Parent.blockIDs) -- the right name of your module?
function placement.setBlockProperties(ID)
local block = blockIDs.Blocks[ID] -- now the table is different since you used the table approach
print(block)
end
return placement