Plugin yielding, can't find child

I’m not sure what’s happening, the script in my plugin can’t seem to find it’s own child called Template.

Code:

local GroupService = game:GetService("GroupService")
local BanList = script.Parent

--Auto Resize
BanList.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
    BanList.CanvasSize = UDim2.new(0,0,0,BanList.UIListLayout.AbsoluteContentSize.Y)
end)

repeat wait(1) until game:GetService("ServerScriptService"):FindFirstChild("GroupBan")
local GroupBanFolder = game:GetService("ServerScriptService"):FindFirstChild("GroupBan")

function CloneTemplate(v)
	local clonedtemplate = script:WaitForChild("Template"):Clone()
	local groupInfo = GroupService:GetGroupInfoAsync(v.Value)
	if not groupInfo then return end
	clonedtemplate:WaitForChild("GrpName").Text = groupInfo.Name
	clonedtemplate:WaitForChild("GroupLogo").Image = groupInfo.EmblemUrl
	clonedtemplate:WaitForChild("ID").Text = v.Name
	clonedtemplate.Name = v.Name
	clonedtemplate.Parent = BanList
end

function UpdateBanList()
	print("Updating BanList")
	--Destroy
	for i,v in pairs(script.Parent:GetChildren()) do
		if v.Name ~= "Loader" or v.Name ~= "UIListLayout" then
			v:Destroy()
		end
	end
	
	wait()
	
	for i,v in pairs(GroupBanFolder:GetChildren()) do
		if v:IsA('NumberValue') then
			CloneTemplate(v)
		end
	end
end

UpdateBanList()

GroupBanFolder.ChildAdded:Connect(UpdateBanList)
GroupBanFolder.ChildRemoved:Connect(UpdateBanList)

Error:

Explorer:
image

How do I fix this?
Thank you!

1 Like

No that’s not it, if that was the case then it wouldn’t even find it.

I kept making reiterations of the code and just now it managed to find the template but only the object called Template was cloned, not the children. Everything is set to Archivable = true so I’m not sure what’s happening. Either I did something stupid or plugin loading is really buggy.

I reverted the code so the code in the post is the latest.

1 Like

I activated my GUI and moved the gui from CoreGUI to workspace and realised that the BanListLoader script and UIListLayout is missing from the scrolling frame.

image

Anyone know why this is happening???
Is it possible that the name BanList could be causing studio to think its a plugin virus or smth

1 Like

I duplicated the gui and deleted the old one, restarted studio and it somehow works now. :confused: