Well there is no built in function does that but you can avoid creating one in many ways by:
a. Turning value of names to string using tostring():
local mags = plr.SkillSet.Magic:GetChildren()
for name,bool in pairs(mags) do
stuff.magic[tostring(name)] = bool.Value --Bad idea, don't do this:
end
or
b. Saving values of BoolValues in another table that is an array inside the dictionary(Recommended option):
local stuff = {
magic = {
null = true,
fire = false,
air = false,
earth = false,
lightning = false,
ice = false,
extradata = {}
}
}
local mags = plr.SkillSet.Magic:GetChildren()
for name,bool in pairs(mags) do
stuff.magic.extradata[name] = bool.Value
end
or
c. Don’t try to save a number at all like you said name the keys after boolvalue’s name(Do not name keys after boolvalue’s parent because that will override them):
local mags = plr.SkillSet.Magic:GetChildren()
for name,bool in pairs(mags) do
stuff.magic[bool.Name] = bool.Value --Don't use this option if there are boolvalue's with same names inside the folder.
end
or if your plan was to override default values in dictionaries with boolvalue’s then option c will work for you.