Clone is only parenting into 1 of the 2 counted

Hi all, I don’t really know how to explain this but I’m trying to clone a SurfaceGUI to go into all the children found using i,v in pairs. So far I’ve had some luck but it’s only going into 1, not all of them. Does anyone know a solution to this?

function module.HttpError()
	local Controllers = script.Parent.Parent.Parent.Controllers:GetChildren()
	local UI = script.Storage.UserInterface:Clone()
	for i,v in pairs(Controllers) do
		if v:IsA("Model") then
			UI.Boot.Visible = false
			UI.Errors.Visible = true
			UI.Errors.Errors.HttpRequests.Visible = true
			UI.Parent = v.Monitor.PCFrame.LCDScreen
		end
	end
	
end

This is the code, I’m new to scripting and It’s probably something really simple but I can’t figure it out.

You’re only calling clone one time, therefore only one clone is created. The clone will be parented to the first gui, but since you’re referencing the same clone in the loop instead of creating a new one, it will be moved to the second gui the next time the loop runs.
Simply move the clone statement into the loop and you should be good!

2 Likes

move this line:
local UI = script.Storage.UserInterface:Clone()

in to the loop, it’s outside of it. You’re only cloning once.

2 Likes

Thank you, I thought It’d be something simple!

2 Likes

Thank you. Greatly appreciated.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.