✓ Accepted answer
This would not work because there is only one of said Instance. The way I would get around this is by cloning the Instance and then moving it to wherever you'd like to
Here is my script:
local listofobjects = {
["owner"] = Instance.new("StringValue");
["type"] = Instance.new("StringValue");
["level"] = Instance.new("IntValue");
["health"] = Instance.new("IntValue");
}
for i,v in pairs (listofobjects) do
for num= 1, 10 do
local obj = v:clone()
obj.Parent = workspace
end
end
Using a for loop in tables will provide two values. The 'i' will provide the name of the variable, and the 'v' will provide what the variable is equal to
As you can see, it clones each Instance 10 times and puts them into workspace.
1 comment
It would create one string object and move it around ten times. You could, however clone the object in the loop and parent the clone where you want to make ten string objects.