wait(1)
local t = {
}
for i, v in pairs(game.Players:GetChildren()) do
table.insert(t,{
["Hello"] = {
["Chance"] = 5
},
})
end
for i, v in pairs(t) do
print(i)
print(v)
end
wait(1)
local t = {
}
for i, v in pairs(game.Players:GetChildren()) do
t["Hello"] = {["Chance"] = 5}
end
for i, v in pairs(t) do
print(i)
print(v)
end
Rather than use table.insert(), which indexes values using integers, you can set the table’s index with the string itself, as shown in the code above. However, one thing odd about this script is that for every player, the table is being set to essentially (not literally) the same thing, meaning the table is always
after any iteration of the loop. I don’t know if this is the intended result, but it’s just something I thought I should point out.
Thank you it works now, I created this script just for solving this problem I had on another script, that is why the table adds one value for every player.