Hello I am trying to insert a table into another table but it became nested tables and I don’t want like that.
Here is my current output. These tables are nested. I don’t how to fix this.
I want a output like this:
{
["4"] = "yes"
["19"] = "no"
["10"] = "no"
["7"] = "no"
["8"] = "idk"
...
}
And this is my script(local script):
local module = require(game.ReplicatedStorage.QuestionsModule)
local list = {}
local x = Instance.new("IntValue")
x.Parent = script
local button_yes = script.Parent.QuestionFrame.AnswersFrame.yes
local button_no = script.Parent.QuestionFrame.AnswersFrame.no
local button_idk = script.Parent.QuestionFrame.AnswersFrame.idk
local button_probably = script.Parent.QuestionFrame.AnswersFrame.Probably
local button_probablynot = script.Parent.QuestionFrame.AnswersFrame["Probably not"]
local a = module.getRandomQuestion(list)
script.Parent.QuestionFrame.Question.Text = module.games[a]
button_yes.MouseButton1Up:Connect(function()
table.insert(list, {[tonumber(a)] = "yes"})
x.Value +=1
end)
button_no.MouseButton1Up:Connect(function()
table.insert(list, {[tonumber(a)] = "no"})
x.Value +=1
end)
button_idk.MouseButton1Up:Connect(function()
table.insert(list, {[tonumber(a)] = "idk"})
x.Value +=1
end)
button_probably.MouseButton1Up:Connect(function()
table.insert(list, {[tonumber(a)] = "prob"})
x.Value +=1
end)
button_probablynot.MouseButton1Up:Connect(function()
table.insert(list, {[tonumber(a)] = "probnot"})
x.Value +=1
end)
x.Changed:Connect(function()
a = module.getRandomQuestion(list)
script.Parent.QuestionFrame.Question.Text = module.games[a]
print(list)
end)