BoolValue

Hold true or false in the tree: a switch or a setting your program reads.

Value is false by default and takes only a boolean. Assigning it fires Changed with the new value; assigning the value it already has fires nothing.

Made with Instance.new("BoolValue") or Clone().

Example

Flip a settingShotScript
-- A BoolValue holds true or false. Settings.DarkMode is one, saved in the project as true.
local dark = root.Settings.DarkMode
dark.Changed:Connect(function(on : boolean)
	print("DarkMode is now " .. tostring(on))
end)
print("DarkMode starts " .. tostring(dark.Value))
dark.Value = not dark.Value
print("a new BoolValue: " .. tostring(Instance.new("BoolValue").Value))
What it printedOutput
DarkMode starts true
DarkMode is now false
a new BoolValue: false

Properties

NameTypeDefaultDescription
ValuebooleanfalseThe true or false it holds; each change fires Changed with the new value, and anything but a boolean errors.
From ShotInstance 33