Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Call values in a table?

Asked by 6 years ago

I have a table with these values:

  data[plr.Name] = {
            Gold = 200,
            Ruby = 10
        }

whenever i use these:

data[plr.Name].Gold
data[plr.Name]["Gold']

they come out nil both times. How do i call on these values?

1 answer

Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago
Edited 6 years ago

http://wiki.roblox.com/index.php?title=Global_namespace/Table_manipulation&redirect=no#table.insert

local tablename = {'player'}

local vector = Vector3.new(1, 2, 3)

table.insert(list, vector) -- inserts vector into the tablename

for i = 1,#tablename do
    print(tablename[i]) -- prints all the names from tablename
end
name = {'roblox', 'shedletsky'} -- roblox is first which is 1, shedletsky is seconds which is 2
print(name[1]) -- prints roblox
print(name[2]) -- prints shedletsky
Ad

Answer this question