uugnut6
(uugnut6)
June 22, 2021, 11:05pm
#1
title describes it
-- Script 1
local ValueNew = Instance.new("StringValue",game.ReplicatedStorage.Stored)
ValueNew.Name = "103"
ValueNew.Value = "Unknown"
local ValueOld = Instance.new("StringValue",game.ReplicatedStorage.Stored)
ValueOld.Name = "104"
ValueOld.Value = "Unknown"
-- Script 2
wait(10)
local Folder = game.ReplicatedStorage:WaitForChild("Stored")
for _,v in next, Folder:GetChildren() do
print(v.Name)
end
Result:
Console: Printed "Value" and "Value"
I don't know what I did wrong
uugnut6
(uugnut6)
June 22, 2021, 11:36pm
#2
i tried using all types of tables, still wont work
I just tested your scripts, and everything works as it’s supposed to.
Console Printed: 103 and 104
Abcreator
(Abcreator)
June 23, 2021, 12:35am
#4
Using the second argument of Instance.new is not recommended and using .Parent is better. There was problems that the parent was getting changed before the other properties (or something like that) were changed which seems to be your issue. Set .Parent after the name and value.
Read:
I’ve discovered a pretty bad performance issue in one of top games that has to do with Instance.new and wanted to write about this, since this is not obvious unless you know the system inside out.
Tthere are several ways to create a ROBLOX object in Lua:
local obj = Instance.new(‘type’); fill obj fields
local obj = Instance.new(‘type’, parent); fill obj fields
local obj = util.Create(‘type’, { field1 = value1, … })
If you care at all about performance, please only use the first option - I wi…