AssemblyLinearVelocity resets itself when parented from nil, inconsistent with the deprecated Velocity property

Issue Type: Other
Impact: Moderate
Frequency: Often
Date First Experienced: 2021-02-05 18:02:00 (-06:00)
Date Last Experienced: 2021-02-06 11:02:00 (-06:00)

Reproduction Steps:

  1. Make a script that creates a part
local part = Instance.new("Part")
part.Anchored = true
part.Size = Vector3.new(10, 1, 10)

--part.AssemblyLinearVelocity = Vector3.new(10, 0, 0)

part.Parent = workspace

part.AssemblyLinearVelocity = Vector3.new(10, 0, 0)
  1. If you set the AssemblyLinearVelocity before it is parented to workspace, it will be set to 0, 0, 0. If you set AssemblyLinearVelocity after it is parented to workspace, it will stay the same as what you set it to.
  2. If you change AssemblyLinearVelocity to Velocity, it works whether you set the parent before or after.

Expected Behavior:
I would expect that AssemblyLinearVelocity would not reset itself when it is parented from workspace, but would stay the same as what it was set to. This is how the deprecated Velocity property worked.

Actual Behavior:
When you set AssemblyLinearVelocity before parenting the part:
image

When you set AssemblyLinearVelocity after parenting the part:
image

When you set Velocity either before or after parenting the part:
image

Workaround:
Setting the AssemblyLinearVelocity property after setting the Parent property.

I’m not completely sure whether this is a bug or if it’s intentional, but I’m posting it anyways because I’m not sure. It just seems to make more sense for AssemblyLinearVelocity to behave the same way as Velocity did.

5 Likes

Bump. This velocity thing caught me off guard. I have no idea how to fix it and now things in my tycoon are broken :confused:

1 Like

Hello. We’ve been unable to reproduce this issue - can you please confirm whether it still occurs? Thanks!

Yes, it does still occur.

The blue part has AssemblyLinearVelocity set before Parent, and it gets set to 0, 0, 0 on its own. The red one has Parent set before AssemblyLinearVelocity and it works properly.

Here is the script:

-- Set AssemblyLinearVelocity first
local part = Instance.new("Part")
part.Name = "AssemblyLinearVelocity First"
part.Anchored = true
part.BrickColor = BrickColor.Blue()
part.Size = Vector3.new(5, 1, 5)
part.CFrame = CFrame.new(0, 5, 5)
part.AssemblyLinearVelocity = Vector3.new(0, 0, 10)
part.Parent = workspace

-- Set Parent first
local part = Instance.new("Part")
part.Name = "Parent First"
part.Anchored = true
part.BrickColor = BrickColor.Red()
part.Size = Vector3.new(5, 1, 5)
part.CFrame = CFrame.new(0, 5, -5)
part.Parent = workspace
part.AssemblyLinearVelocity = Vector3.new(0, 0, 10)

This is expected behavior.

AssemblyLinearVelocity operates on assemblies. Assemblies are a physics concept that only applies to parts in a physical world. Thus, if your part isn’t in the Workspace (or a WorldModel), it won’t be part of an assembly, and won’t have an AssemblyLinearVelocity.

So your issue has nothing to do with moving between the Workspace and somewhere else, it’s simply about not being in the Workspace:

local part = Instance.new("Part") 
part.AssemblyLinearVelocity = Vector3.new(1, 1, 1) 
print(part.AssemblyLinearVelocity) --> 0, 0, 0

Is there something that the old behavior gets you that is hard to accomplish now?

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.