ValueBase
The base of every value object: one typed value in the tree, so a mistake shows before anything runs.
Each value object holds one Value of its own type, and assigning another type errors instead of converting it. Changed on a value object fires with the new value, and only when Value changes; use GetPropertyChangedSignal("Name") to hear a rename. The project file writes a value only when it isn't the default. ValueBase itself is never made: make one of its classes, such as StringValue.
A base class: you work with its subclasses.
Example
-- Every value class is a ValueBase: one Value, and Changed passes the new value. Settings holds three of them.
local settings = root.Settings:GetChildren()
table.sort(settings, function(a : ShotInstance, b : ShotInstance) : boolean
return a.Name < b.Name
end)
for _, setting in settings do
print(setting.Name .. ": " .. setting.ClassName .. ", IsA ValueBase " .. tostring(setting:IsA("ValueBase")))
end
local count = root.Settings.Count
count.Changed:Connect(function(value : number)
print("Count changed to " .. value)
end)
count.Value += 1Count: IntValue, IsA ValueBase true DarkMode: BoolValue, IsA ValueBase true Title: StringValue, IsA ValueBase true Count changed to 4
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
Subclasses
