So I am trying to make it so you are able to change a dummy's appearance by user id with a screengui. I have code that I made Localscript (For changing the value of the id (There is an int value))

local useridtext = script.Parent
local userid = script.Parent.UserID

useridtext.Changed:Connect(function()
	userid.Value = useridtext.Text
end)

Localscript (For sending out the value to change a dummy appearance)

local id = script.Parent.Parent.ID.UserID

script.Parent.MouseButton1Click:Connect(function()
	id.Changed:Connect(function()
		local Models = game.Players:GetCharacterAppearanceAsync(id.Value)
		Models.Parent = game.Workspace
		wait()
		for i,v in pairs(Models:GetChildren()) do
			v.Parent = game.Workspace.Dummy
			wait()
		end
	end)
end)

Is there a better way to write this or like to make it work without spawning the hats and stuff not on the dummy? If you want to is there a way to do this for all children in a folder?