-- Color table
colors =
{
[0] = {"blue", "Pastel Blue", "Cyan"};
[1] = {"red", "Persimmon", "Really Red"};
[2] = {"orange", "Gold", "Deep orange"};
[3] = {"green", "Shamrock", "Lime green"}
}
-- Changes tycoon template colors
game.workspace.Tycoons.ChildAdded:connect(function(child)
local tycoons = child.Parent:GetChildren()
local children = child:GetDescendants()
local str = Instance.new("StringValue", child)
str.Name = "Tycoon_Color"
str.Value = 1
table.remove(colors, #tycoons - 1)
for i = 1, #children do
if children[i].Name == "light" then
print(colors[child.Tycoon_Color.Value[1]])
end
if children[i].Name == "dark" then
end
end
end)
-- Clones tycoon template to tycoon spawns
local spawns = game.workspace.Tycoon_Spawns:GetChildren()
for i = 1, #spawns do
local picked = spawns[i]
local clone = game.workspace.Test_Tycoon:Clone()
clone.Parent = game.workspace.Tycoons
clone:SetPrimaryPartCFrame(CFrame.new(picked.Position))
clone:SetPrimaryPartCFrame(clone:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(picked.Orientation.y), 0))
picked:Destroy()
if i == #spawns then
game.workspace.Tycoon_Spawns:Destroy()
end
end
COMMUNITY QUESTION
How do i call on a value in an index in a dictionary?
1 answer
To grab information for an Array or Dictionary you need to give the script the array or dictionary name and the key. For your case, if I wanted to grab the first row of information I would type local Variable = colors[0]. That should give you the string of the blue colors. If you need more help here is a link to the Roblox Developer page explaining the basics of Tables, Arrays, and Dictionaries: Roblox Developer - Tables
1 comment
0
ye ik that but how do i pick a variable in the 0 table
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
I am trying to call 1 of the 2 values in the indexs
dude we need more info
im literally just trying to call a value from an index in a table do i gotta spell it out for u greatneil80