I’m making a settings module and I need to know how I could get the name of the setting, but not the value of it.
How would I get this from a script?
I’m making a settings module and I need to know how I could get the name of the setting, but not the value of it.
How would I get this from a script?
for name, value in pairs(Settings) do
print(name, value)
-- example: MusicSystem true
end
You can just do Settings[“Name”] to get the value!
They just want to get the index I believe
He wants the name, not the value
Works when printing this, but in my script it seems to think the value is nil
function module:Boot(SettingsTable,GamepassTable,ProductsTable,CreditsTable)
local SFolder = Instance.new("Folder",game:GetService("ReplicatedStorage"))
SFolder.Name = "workFrameSettings"
for _, name, value in ipairs(SettingsTable) do
if typeof(value) == "string" then
AddValue(name,"string",value)
elseif typeof(value) == "boolean" then
AddValue(name,"bool",value)
elseif typeof(value) == "number" then
AddValue(name,"number",value)
else
print(typeof(value).. " Error, other unknown value")
end
end
end
I want both, as I need the setting value. Would be a funny setting without a value lol
It’s just
for name, value in ipairs(SettingsTable) do
Worked thank you very much!
It might be an issue with your implementation of ipairs
, try replacing it with this temporarily to see if it changes anything:
function module:Boot(SettingsTable,GamepassTable,ProductsTable,CreditsTable)
local SFolder = Instance.new("Folder")
SFolder.Name = "workFrameSettings"
SFolder.Parent = game:GetService("ReplicatedStorage")
for name, value in ipairs(SettingsTable) do
if typeof(value) == "string" then
AddValue(name,"string",value)
elseif typeof(value) == "boolean" then
AddValue(name,"bool",value)
elseif typeof(value) == "number" then
AddValue(name,"number",value)
else
print(typeof(value).. " Error, other unknown value")
end
end
end
Thanks for the heads up, I’ll keep that in mind and rewrite that part of my code.