Add ValueBase.Value

Note: I had no idea how to clearly phrase the title, but it is in no way me proposing a solution.

As a Roblox developer, it is currently too hard to feasibly access the Value property of any ValueBase sub-class without specifying an exact sub-class in nonstrict/strict mode. This is because ValueBase.Value doesn’t exist; instead it’s a property of every sub-class (except for BinaryStringValue)


Above, I have a snippet of code which is used to compile every ValueBase instance into a dictionary which I save to data stores. I check to make sure it inherits ValueBase and then access Value. Since Value isn’t an existent property of ValueBase, it throws the “Key ‘Value’ not found in class ‘ValueBase’” notice.

If Roblox is able to address this issue, it would improve my development experience because then I could get Value from ValueBase instead of having to specify each individual ValueBase sub-class, which again, isn’t a feasible option.

1 Like

The reason this doesn’t exist is because they aren’t the same property. Vector3Value.Value is a Vector3, and NumberValue.Value is a float. ValueBase doesn’t actually have a Value property unto itself. There are a couple of big reasons why this doesn’t make sense to include.

If you wanted it in the documentation specifically, would you specify it as a var/any/whatever? It’s not an any type in the inheritors, so it doesn’t make sense to include it in the documentation.

Or if this were implemented beyond just documentation, it would need to specify a type under most OOP rules for inheritance. And it can’t do that since all of the inheritors use different types.


Oh my god I’m an idiot I did not think about that!! Sorry for wasting your time… :confused:

From what you said it sounds like it wouldn’t be possible to have custom behavior for it to work with luau type checking since you could set incorrect value types to them.

So I’m guessing the best way to go about this for my specific use case or anyone else who might have the same problem is to just individually type each individual ‘sub-class’ out as long as I know that I’ll always be giving it the correct type? Even if it might be ugly it may be the best solution?


I’ve not actually worked with roblox’s type system, so if you can get it to work I’ll call it good. Hopefully someone is a little more knowledgeable than I am and can give you the absolute best way, but good luck on your travels.