Damagex443 recently helped with a script of mine and he did something I never saw with tables. He indexed "i" with the variable "Clone" and then put it in the table "ClonedArms"(line 22),is this another way to insert values into a table or what? I'm really confused.
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
---------------------------------------------------------
function MakeDisplayArms()
wait()
---------------------------------------------------------
local CurrentCamera = game.Workspace.CurrentCamera
local PlayerArms = {
Character["Right Arm"],
Character["Left Arm"]}
local ClonedArms = {}
---------------------------------------------------------
for i,v in pairs (PlayerArms) do
Character:WaitForChild(v.Name)
local Clone = v:Clone()
Clone.Parent = CurrentCamera--Hides it from everyone else
Clone.Name = "Cloned_"..v.Name --Renames it
Clone.CanCollide = true
local Weld = Instance.new("Weld",Clone)
Weld.Part0 = Clone
Weld.Part1 = v
ClonedArms[i] = Clone
end
return ClonedArms
end
---------------------------------------------------------
Arms = MakeDisplayArms()
for i,v in pairs (Arms) do
print(v)
end
end)
end)
My questions/thoughts:
. How could he replace a index with a part's name?
. Can't a index only be numbers?
. How did he insert the variable "Clone" in the table without using table.insert?

2 comments
If I wanted to remove the arms from "ClonedArms" everytime the player dies,would I just remove it with ":destroy()" or will I have to remove it off the table?
Well, if they should be back on respawn, then you'll just have to destroy them. The script you have above will then overwrite the old table with the new values, but if you really want to remove everything then you should empty the table too. You can do this by building another for loop that iterates over each child. Check if the name and childname match and then use table.remove(ClonedArms, i).