Soo, i was a little bored, and i have made this:
local AddedChilds = game:GetService("ReplicatedStorage"):WaitForChild("AddedChilds")
game.ChildAdded:Connect(function(Child)
local Success,Error = pcall(function()
local ChildName = Child.Name:lower()
local Child2 = Instance.new("ObjectValue")
Child2.Parent = AddedChilds
Child2.Value = Child
Child2.Name = Child.Name
end)
if Success then
print(Child.Name.." has been added into the AddedChilds folder.")
end
end)
The issue is that, it will not run every single time, an child is added, so, what will i do to stop this? Will i have to make an while loop that has e.g, game.ChildAdded:Wait()
in it?
Also, if you’re asking what this code does, it inserts an ObjectValue in an folder located in ReplicatedStorage whenever an child is added to the game. The ObjectValue will have the name and value set to the added child.