Game Prints Random assemblyvelocity values even w/ no movement

I’m testing stuff and I want to be able to print the velocity of another humanoid(other than the player) in order to figure out how fast it’s going.

My issue is that whenever I test run the game, the velocity of the nonplayer humanoid would be constantly changing despite there being nothing touching it and no visible movement from the humanoid. This makes it a lot harder to read the velocity and in turn, makes my job of finding the issue a lot more annoying and tedious.

example:

What I’ve tried so far:
I’ve removed elasticity to make sure it doesn’t bounce and I’ve also given network ownership to the player(who reads the velocity values). There are no animations

here’s my localscript:

-- VARIABLES AND SERVICES
local RunService = game:GetService("RunService")
local wfc = game.WaitForChild

-- testhumanoid
local testc = wfc(workspace,"testh")
local testh = wfc(testc, "HumanoidRootPart")

-- print testh velocity
RunService.Stepped:Connect(function()
	print(testh.AssemblyLinearVelocity)
end)

placefile
Baseplate.rbxl (155.7 KB)

Thanks!

Velocity is kind of a tricky thing to get to be exactly 0,0,0.

Those numbers in your screenshot are actually extremely small values even if they look like they’re more.

For example the first number listed in your screenshot is ACTUALLY
-0.00000002365852239977

You have a few options.

  1. You can compare its magnitude, check if it’s less than a certain amount and if it is, set it to Vector3.zero. This would look like
if testh.AssemblyLinearVelocity.Magnitude < 0.1 then
     testh.AssemblyLinearVelocity = Vector3.zero
end
  1. You can floor or round the values, one at a time in a new Vector3 like so
local velocity = testh.AssemblyLinearVelocity
testh.AssemblyLinearVelocity = Vector3.new(math.floor(velocity.X), math.floor(velocity.Y), math.floor(velocity.Z)
1 Like

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