Currently on Roblox, it is too hard to save some common Roblox types into data value instances. Some existing examples: BoolValue, Color3Value, Vector3Value.
I propose adding more value types for these data types:
- Vector2
- UDim
- UDim2
- NumberSequence
- ColorSequence
- Content (functionally identical to StringValue, but with Studio image picker)
I also propose adding another instances which doesn’t store any data, but instead describes data: NilValue. NilValue could be used to represent a value not existing. It doesn’t have a value - it doesn’t even have any functionality - but it has semantic value.
One example of a use case for NilValue is a simple script - it reads values from inside of itself and applies them to another object, in this case applying properties to a TextButton:
local target = PlayerGui.TextButton
for _, value in pairs(script:GetChildren()) do
target[value.Name] = value.Value
end
This works well for most things, but what if we wanted to set a property to nil? We could use NilValues to represent properties to set to nil:
local target = PlayerGui.TextButton
for _, value in pairs(script:GetChildren()) do
if value:IsA "NilValue" then
target[value.Name] = nil
else
target[value.Name] = value.Value
end
end