Detecting player's speed while sitting?

Hey! Simple question, I have this script:

script.Parent.SpeedValue.Text = player.HumanoidRootPart.AssemblyLinearVelocity.Y

That works when I jump, but doesn’t work when I’m sitting down. How can I make it work with that? thank you for the help!

1 Like

When’s the text updated? The code provided only seems to work once.

I just use RenderStepped to update a local script : )

Not sure what you mean

The AssemblyLinearVelocity property would only detect if a Player’s Character axis changes as they’re applying force (Or in simple terms, they move (X & Z) and jump (Y) their character)

It’s not exactly possible to detect the Y value of the Character, as there’s no Velocity being detected at all when they sit on a seat, unless if the seat itself has physics being assigned

1 Like

Have you tried using

script.Parent.SpeedValue.Text = player.HumanoidRootPart.Velocity.Y

?

Not to burst your bubble, but Velocity is now deprecated as it wouldn’t really make any difference

Plus Velocity & AssemblyLinearVelocity would be considered the same?

2 Likes

Oh i wasn’t really aware of this change :sweat_smile:.
I thought AssemblyLinearVelocity was some new property that did something different.
Well in this case i dont get it, because if there’s physics happening and the torso is moving then the velocity should change :thinking:.

AssemblyLinearVelocity is just the new & more modernized term as a replacement for the Velocity property, not sure why people still use it though

Depending on the use case you can just write a custom velocity tracker. Something something heartbeat service and the new absolute vector minus the old absolute vector.

2 Likes

I mean just use magnitude between the two vectors.

I remember doing something like it ages ago, I had to go find the thread. Don’t know if it can help you or not. Also the code is awful, but the concepts still apply.

if char.HumanoidRootPart.Velocity.Y > 0 then
    local characterSpeed = char.HumanoidRootPart.Velocity.Y

    --rest of code but keeps the characterSpeed
end

BasePart velocity is deprecated. Idk what the normal alternatives are because I only recently returned to Roblox since 2 years ago.

I do not use Velocity ever really lol so I do not know

Velocity works but is kinda wonky

This is no excuse to use something that is deprecated. It is subject to stop working in the future.

I know I use Velocity sometimes I do not know AngularVelocity

You mean something in the lines of:

Player=game:GetService("Players").LocalPlayer
HRP=Player.Character:WaitForChild("HumanoidRootPart")
Velocity=Vector3.new(0,0,0)
Old=HRP.Position

game:GetService("RunService").Heartbeat:Connect(function()
local pos=HRP.Position
Velocity=(pos-Old).Magnitude
Old=pos
end)

? Because this is just brilliant.

Yea that was the solution to that thread I posted but I don’t know if running your own velocity tracker is optimal even though math is low cost. I’m sure there’s probably a better solution somewhere in the thread where velocity was originally deprecated.

1 Like

Yes that would be a downside… although i don’t feel like it would be too much of a problem if you’re not gonna use it on a lot of stuff.

This ended up working for me! Thank you for the help dude!

1 Like