I'm making a script that would make a TextButton for each Tool inside a Folder inside ServerStorage. I have a script that should duplicate a TextButton and fill in the Text and Name with the Name of a corresponding Tool inside the ServerStorage. It just does nothing.

local CurrentTool
local ChildrenOfItems = game.ServerStorage.Items:GetChildren()
script.Parent.Number.Value = #ChildrenOfItems
-- find how many tools there are

while true do
	script.TempStorage:Clone(c)
	c.Parent = game.ServerStorage.Items
	-- to make a place to store tools already checked
	while i ~= script.Parent.Number.Value do
		script.Parent.Buttons.Default:Clone(h)
		-- make a clone of the text button
		h.Script.Disabled = false
		h.ItemsToAdd.Value = game.ServerStorage.Items:FindFirstChild()
		h.Position.T.Offset = h.Position.T.Offset + (i * 100)
		-- customise the new button
		CurrentTool = game.ServerStorage.Items:FindFirstChild()
		CurrentTool.Parent = game.ServerStorage.Items.TempStorage
		-- move the tool into the storage
		i = i + 1
	end
	i = 0
	while i ~= script.Parent.Number.Value do
		CurrentTool = game.ServerStorage.Items.TempStorage:FindFirstChild()
		CurrentTool.Parent = game.ServerStorage.Items
		wait(0.1)
		i = i + 1
		-- move out of storage
	end
	break
end

The script is inside a ScrollingFrame that has a Folder called Buttons with a TextButton called Default in it and a NumberValue called Number.

1 comment

0

Try setting the parent first, just after cloning it. If that doesn't work, @ me.