How to check if a folder's --> Folders Child has changed?

I am trying to find a way to add a frame when a player becomes on a team and it displays their status ect.

This is all set via a 2 folders in replicated Storage?

How can I find if a folder’s → Folders’ Child has changed?

Make an Instance.ChildAdded connection for the folder to detect when something’s placed there

1 Like

Hello, I done that but it doesn’t detect anything.

I even tried it with a print before my main script and it doesn’t print anything.

Could you show us your script please

1 Like
local UnitFolder = game.ReplicatedStorage.LRC_MDT.CAD_Control.UNITS
local UnitEvent = game.ReplicatedStorage.LRC_MDT.LRC_Events.Unit_Event

UnitFolder.ChildAdded:Connect(function(child)
	print(child.Name)
	if child:IsA("Folder") then
	for i, item in pairs(UnitFolder:GetChildren()) do
		if  item:IsA("Folder") and game.Players[item.Name]:WaitForChild("PLR_LRC_MDT").Team.Value == true then
			local Unit = script.Unit_Templete:Clone()
			Unit.Name = item.Name

			if script.Parent.Unit_Overview:FindFirstChild(item.Name) ~= nil then

				script.Parent.Unit_Overview[Unit.Name]:Destroy()	
				
		elseif script.Parent.Unit_Overview:FindFirstChild(item.Name) == nil then
				for i, item in pairs(UnitFolder:GetChildren()) do
					if  item:IsA("Folder") and script.Parent.Unit_Overview:FindFirstChild(item.Name) == nil then
						Unit.Name = item.Name
						Unit.Parent = script.Parent.Unit_Overview
						Unit.Unit_Info.Enabled = true
						end
					end
				end
			end
		end
	end
end)



1 Like

All the values ect do link as it works in a while true do but it isn’t efficient

It seems you’re using a custom team implementation. I suggest you try using Roblox’s built-in team implementation as shown here as it works well and will make scripting much easier

Thanks, This script doesn’t involve a Team? I’m not sure what you mean, Could you explain?

From what I understand, you want to create a Frame Gui for a Player when they join a team. Using Roblox’s method would make detecting when a Player joins a Team much easier. I can show you an example if you want

Have you got dizzy so I can explain clearer?

1 Like

This is what you said on your main post:

Oh Sorry, I meant when a folder’s folders value has changed or a new child to that 2nd folder has been added I need it to clone a frame and display it. My Bad explanation

Is your script a LocalScript or a server Script?

Server Script

5546546546456546

DescendantAdded fires when the Instance Descendants has gotten a child in like if something got added in your 2nd folder, it will run the function

I’ll try it

0000000000000000000000000000

Then I think I have a solution (I’m on mobile though so it’s an example of how to solve it):

for _, folder in mainFolder:GetChildren() do
   if folder:IsA”Folder” then
       folder.ChildAdded:Connect(function(child)
         Handle the frame cloning logic here
       end)
   end
end

Ok, I’ll also give this a try

00000000

This didn’t work either I don’t think

Do you have any errors in the output?