QueryBuilder
A verbose query builder for the QueryDescendants api.
Github Repository (Downloadable rbxm can be found in the releases tab)
Examples
local QueryBuilder = require(path.to.QueryBuilder)
local Query = QueryBuilder.new()
:SetClass("Model")
:SetName("Car")
:Child(
QueryBuilder
:SetClass("VehicleSeat")
:SetProperty("Disabled", false)
:Not(QueryBuilder:AddTag("Broken"))
)
:ToQuery()
-- Output: "Model#Car > VehicleSeat[Disabled = false]:not(.Broken)"
local QueryBuilder = require(path.to.QueryBuilder)
local v = QueryBuilder.value
local Query = QueryBuilder.fromOperation(function(part)
local prompt = part:FindFirstChildOfClass("ProximityPrompt")
if prompt then
-- Path 1: If it has a prompt, it must be the "Interact" prompt
return prompt.Name == v("Interact")
else
-- Path 2: If no prompt, it must be named "StaticPart"
return part.Name == v("StaticPart")
end
end):ToQuery()
-- Output: ":has(> ProximityPrompt[Name = "Interact"]), #StaticPart:not(:has(> ProximityPrompt))"
Thank you for coming to my ted talk