When I add a StringValue with a BoolValue inside in the Workspace, this function is supposed to run in a LocalScript inside the PlayerGui.
Workspace.ChildAdded:connect(function(child) if child:IsA("StringValue") then print(child.Name) print(child:FindFirstChild("BoolValue").Value) end end)
It doesn't seem to be working when I set the game to Workspace.FilteringEnabled
, and only finds the child, and returns BoolValue as nil (It does work, however when it is not in FilteringEnabled).
UPDATE: I managed to come up with a alternative for now, not sure if there is a simpler one. I added an ObjectValue just to simply store the StringValues and BoolValues so DescendantAdded will only check the ObjectValue.
Workspace.ObjectValue.DescendantAdded:connect(function(child) if child.Parent.Name == "StringValue" then print(child.Value) -- Prints the value of BoolValue print(child.Parent.Value) -- Prints the value of StringValue end end)
I'm not sure why this works in FilteringEnabled if you get the instance you want in the parent's instance.
That's because the instance may have been streamed out. From the wiki
Because this feature changes the way parts are sent to the client, scripters will have to keep in mind that objects referenced in local Lua scripts might have not arrived or have been streamed out.
Read more at http://wiki.roblox.com/index.php/Network_streaming