Sorry for the weird title but I cannot explain it better, I can just show it to you.
local Table = {
['Apple'] = 10
}
local Target = 'RedcommanderV2'
local TargetKey = 1000
print(Table.Apple)
table.insert(Table, 'Banana')
Table.Banana = 11
table.insert(Table, TargetKey)
Table.TargetKey = Target
while wait(2) do
for i,v in pairs(Table) do
print(i..' '..v)
end
end
As you can see, I'm trying to use this
table.insert(Table, TargetKey)
Table.TargetKey = Target
To set the value to a string value
The problem is that it would create a new value named TargetKey, that's not what I want, I want the value of TargetKey (I inserted the value into the table as you can see) to be equal to the string name
(This script is just for testing, it's not a real script I use)
Is there any way to do this?

4 comments
See you're right, it works, but like you can see , the index is behind apple and banana, but it's 1000 redcommanderv2 though, why is it like that, isn't there a way to do it the same as a and b?
I'm not sure what you mean by "a and b" Do you mean in a certain order?
No, like you see, lines 17 and 19 print the variable and then the index, line 18 does it reversed
So you're saying it should print "RedcommanderV2 1000" ?