Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I scan a model for a value that is false? [solved]

Hello!

How do I scan a model for a BoolVaue that is false?

1 comment

0

no need to, figured it out by myself...

1 answer

Just for an answer if someone is wondering this same question, you can either do,

local model = game.Workspace.model

for _,get in pairs(model:GetChildren()) do
	if get:IsA("BoolValue") then
		if not get.Value then
			print("Value is false")
		end
	end
end

Or use recursion if it's a tree of parts,

local model = game.Workspace.model

function recurse(obj)
	for _,get in pairs(obj:GetChildren()) do
		if get:IsA("Boolvalue") then
			if not get.value then
				print("Value is false")
			end
		end
		if #get:GetChildren() > 0 then
			recurse(get)
		end
	end
end

for _,get in pairs(model:GetChildren()) do
	if get:IsA("Boolvalue") then
		if not get.value then
			print("Value is false")
		end
	end
	if #get:GetChildren() > 0 then
		recurse(get)
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.