When setting the property LinearVelocity.MaxForce to an incompatible type, no runtime error is thrown, but the assignment is silently ignored.
For example:
local a = Instance.new("LinearVelocity")
a.MaxForce = {} -- Assigning table when property needs a number
print(a.MaxForce) -- Prints 0, demonstrating that assignment was ignored, and no error was thrown
I noticed this when converting a project from BodyVelocity to LinearVelocity. I didn’t realise that MaxForce was a number in LinearVelocity, so it took me a while to figure out that the Vector3 assignment, as carried over from the script written for BodyVelocity, was being silently ignored by LinearVelocity.
Expected behavior
As the assignment value can’t be converted into a number value, a runtime error should be thrown.
For example, with the old BodyVelocity, trying to assign a number to BodyVelocity.MaxForce errors with Unable to assign property MaxForce. Vector3 expected, got number
I was able to reproduce, but when I added --!strict I was also able to get a type error. Have you verified the type checking mode? If it was in nonstrict mode, this would make a ton of sense since a will have the type any rather than the value it was initialized with.
You can double check this by hovering on a and see that the type is any instead of LinearVelocity.
We are not planning to fix this for now because it can cause many existing experiences to break who are relying on this behavior unintentionally and migrating all of them is not practical. We may address this in the future if there is an opportunity for supporting all existing experiences or a proper migration path is possible.