local traits = {
powerful = "Powerful",
manic = "Manic",
insane = "Insane",
motivational = "Motivational",
inspiring = "Inspirational",
Audacious = "Audacious",
Brave = "Brave",
Arrogant = "Arrogant",
Emotional = "Emotional",
Intelligent = "Intelligent",
Unintelligent = "Unintelligent",
}
local nations = script.Parent:GetChildren()
for i,nation in pairs(nations) do
print(nation)
if nation:IsA("Folder") and not nation:IsA("Script") then
local Leader = nation:FindFirstChild("Leader")
Leader.Traits.Value = next(traits)
end
end
I’m trying to get a random trait from the dictionary above, since math.random doesn’t work for dictionaries, i used next() but that only chooses one trait from the dictionary instead of randomly choosing different traits for different leaders.
Without knowing what you are trying to actually do with it, I can’t provide the best solution.
The answer @Dev_Peashie gave should work for what you want