I’m trying to both store some data and functions in the same ModuleScript. I’m not that used to these, sorry if it’s a super dumb question.
local data = {
["radioGroupId"] = {4645368, 4645608, 5277734, 12752322, 5278317, 4645374, 12821339}
}
function data.playerIsHired(player)
if player.Team == game.Teams.Canadians then return end
for _,id in pairs(data["radioGroupId"]) do
if player:GetRankInGroup(id) >= 2 then
return true
end
end
end
return data
How can I look up data in the table, and how can I call the function?
But what if I also want to just take out data from the table? i.e. just get all group IDs the radio is valid for, not actually use the ModuleScript’s function (there is more data than just this in the module but I didn’t want to leak it on the DevForum for now)
print(data.radioGroupId)
for _, groupId in pairs(data.radioGroupId) do
end
Module scripts are basically just a ServerScript/LocalScript + a table combined.
If this helped mark either of my posts as the solution so a moderation does not have to close this topic.