Add Vector2Value

As a Roblox developer, it is currently too hard to create a sharable value for Vector2’s. You end up using a Vector3Value!

This has big issues when trying to transfer a vector that only has 2 issues, as Vector3’s cannot be muliplied with Vector2’s, and so storing any x/y value like absolute size in a Vector3Value requires more data being moved around, decreasing performance.

If Roblox is able to address this issue, it would improve my development experience because I could use Vector2 values in my code!

43 Likes

Some further explanation of use cases to support this request.

Some developers use ValueBases (e.g. NumberValue) to represent data belonging to Instances. Among a number of other reasons, this is convenient because:

  1. Replication from the server is simple (just change the value - no need to fire and listen for remotes)
  2. Replication uses coalescing behavior (only the latest property value is sent when replication occurs, not any intermediate values).

The lack of Vector2Value object means that developers wishing to attach Vector2 data belonging to an object must either:

  1. Use a different (and more complicated) system of replication; or
  2. Use a Vector3Value, which is not only wasteful (see above), but also inconvenient because the developer has to write code on either end to convert back and forth between data types.
18 Likes

Thank you! My original post was poorly written to articulate this!

Might as well include all the other missing types:

  • Axes
  • ColorSequence
  • Faces
  • NumberRange
  • NumberSequence
  • PhysicalProperties
  • Rect
  • Region3
  • Region3int16
  • UDim
  • UDim2
  • Vector2int16
  • Vector3int16

Also worth mentioning that ValueBases have utility with TweenService for tweening values generally, so it would be nice to at least have all the tweenable types covered.

21 Likes

Is there any reason that Attributes (once released) won’t fulfil the use cases which these would?

1 Like
  • Can’t tween attributes.
  • Requires the baggage of some particular class, unless an empty class to be used specifically for holding attributes is added.
14 Likes

Exactly this! Attributes aren’t the solution to everything!

2 Likes

Why not? ‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Because it’s currently not implemented, to my knowledge.

I have since been told that it will be implemented.

3 Likes

I just ran into this today with a city builder grid placing system where I identify coordinate placement on a planar grid using Vector2. Converting to and from Vector3 is a bit annoying and makes it less readable for someone else to come along and understand what’s going on.

Attributes probably would satisfy my use case though, so long as they are replicated from server to client, so hopefully those arrive sooner rather than later.

Is there somewhere where we can go and see all the specification about Attributes, like the Tween question in earlier replies, and the replication question in mine?

1 Like

Attributes solve the replication thing, which is great.

I just think there’s a use-case for Vector2 values, and other values that we can use in code past replication. The biggest thing is the exposure of

  1. Type checking
  2. Changed event
  3. Value de-duplication
  4. Deconstruction

All in one encapsulated package. Attributes of course, are a grab bag of items. In many cases, I want just one value to be exposed.

2 Likes

Bumping because this is still an issue affecting the development of tooling for my 1.5mil MAU game Bad Business

6 Likes

Is there a reason why you can’t use Attributes?

I think Roblox will be deprecating ValueBase soon

2 Likes

No CFrame or Int (intvalue rounding behavior is super useful to me) attributes still. I also add attributes to the *values for extra behavior.

3 Likes

Im surprised this feature is not implemented yet. I think this change is imperative to the success of modernized roblox games…

Using multiple attributes for numbered values to represent things like Vector2,3,CFrame types is very inconvenient.

I’ve swapped to ValueObject for my internal state objects. I wouldn’t assume this is coming anytime soon.