local Location = script.Parent.Main.Chat.Chat
local function ClearChat()
for _, V in pairs(Location:GetChildren()) do
if V:IsA("TextLabel") then
V:Destroy()
end
end
end
local count = 0
script.Parent.Main.Keyboard.ChildAdded:Connect(function()
print(count)
for _,v in pairs(Location:GetChildren()) do
if v:IsA("TextLabel") then
count = count + 1
end
end
if count < 12 then
ClearChat()
end
end)
Im trying to check how many children are in a instance, but the value wont go up when on is added
it seems that the “location” variable is set to script.Parent.Main.Chat.Chat and the childadded event is set to script.Parent.Main.Keyboard. maybe that could be the issue?
also make sure to set the count back to 0 before the for i, v loop else the count number will keep going up.