QueryDescendantAdded

so everyone knows we can use game:QueryDescendants() but this doesn’t solve DescendantAdded checks

game:QueryDescendantAdded("ScreenGui"):Connect(function(gui)
     print(gui.ClassName) --always screengui no need to have filter check for classnames
end)
game.DescendantAdded:Connect(function(inst)
       if inst.ClassName~="ScreenGui" then
             return
      end
      print(inst.ClassName) --always screengui too, but it needs a filter classname check
end)

why this then? I think QueryDescendantAdded would be more optimized than listening for every new descendant since the engine would handle it on its c++ side instead of having luau checks

This is a similiar problem to object.Changed that was resolved with object:GetPropertyChangedSignal(“Name”) that’s why i want an engine solution for this specific problem

8 Likes

maybe direct children too

1 Like

Shut up coza how would they even add that where are you going to pass the query into they’d need to add a new Connect member and make it work on things other than the Added archetype or else it would be bloat and garbage. Knowing them they’d probably use Instances for it too. Or how about some new slop like an Object. Yeah let’s just have a completely new constructor for querying that sounds like an excellent idea. I think we all need that. I’m all for it I want that. They should make it only work with deferred events and server authority for no reason. I need this in my life. I think I’d actually give not one but two of my kidneys for it that’s just how desperate I am I just need more abstraction just give it to me please.

2 Likes

Exactly
we don’t need more bloat
We need less
Cut ze fluff :raised_fist: :gear:

1 Like

true QueryChildAdded would be nice too

1 Like

chill out bro roblox ignores my feature requests anyways and i doubt they will actually add this cuz it usually takes them 10 years to finally do that

even then for me its very rare to get actual staff response on feature requests

You don’t need that. You can already do > ScreenGui to only look for direct children of an instance.

1 Like

but you cannot connect to ChildAdded event without having that pesky if child.ClassName==“blabla” check

thats the entire point of this post and same issue was resolved before with object.Changed because roblox added object:GetPropertyChangedSignal instead

How would game:QueryDescendantAdded("> ScreenGui") not solve your issue? It would be the equivalent of ChildAdded event with IsA check.

2 Likes

wait thats right i didn’t think about it lol thanks

2 Likes

yea but you get 0.00000001% performance increase because the check is handled on the all powerful c++ side.

sounds worth it to me

1 Like

The check would still be handled on the C++ side even if it was done via a theoretical QueryDescendantAdded method.

Perhaps we should be constructive instead of directly insulting the OP and their post?

1 Like

feel free to completely ignore him i know him and hes usually like this

1 Like