How to get the magnitude of the velocity of the HumanoidRootPart without using deprecated work?

So before, I was able to calculate how my ROBLOX character moves using:

local velocity = HumanoidRootPart.Velocity
local magnitude = velocity.Magnitude

if magnitude > 0 then
    print("HumanoidRootPart's velocity->magnitude: " .. magnitude)
end

Is there another alternative besides using the deprecated Velocity property of BasePart? I have no idea where to go with this.

Save the current cframe every frame, and on the next frame, find the distance between the current CFrame and Cframe from the last frame.

Doesn’t work. I can already tell by this answer.

Calculating this could be done via the following properties/method which were released last month:

AssemblyLinearVelocity
AssemblyAngularVelocity
:GetVelocityAtPosition

A Roblox Staff member confirmed in the Release Notes that using part:GetVelocityAtPosition(part.Position) is how you could replicate the old Velocity property, but the AssemblyLinearVelocity property is what the majority of use cases may require.

3 Likes

Sounds legit. I’ll mark as solution.

1 Like