HumanoidRootPart Velocity Problem

Hello, so while working on the game I encountered a weird bug related to the HumanoidRootPart.Velocity. I have to clarify that I was looking for any bug reports or posts similar to this one on dev forums and didn’t find, that’s why I decided to post it here.
It is local script giving the ability for player to use super jump on a KeyBind. It works as inteded except it adds more velocity with every use and I find it strange. Thanks for attention!

The script

UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == KeyBind and not debounce then
local chargeAnim = hum:LoadAnimation(script.charge)
chargeAnim:Play()
chargeAnim.Stopped:Connect(function()
chargeAnim:AdjustSpeed(0)
chargeAnim.TimePosition = chargeAnim.Length
end)
end
UIS.InputEnded:Connect(function(input, gameProcessed)
if input.KeyCode == KeyBind and not debounce then
print(“pressed: \t”…KeyBind…" debug")
local chargeAnim = hum:LoadAnimation(script.charge)
local jumpAnim = hum:LoadAnimation(script.jump)
char.HumanoidRootPart.Velocity += Vector3.new(0, 5, 0)
jumpAnim:Play()
wait(1)
char.HumanoidRootPart.Velocity = Vector3.new()
debounce = true
wait(5)
debounce = false
end
end)
end)

Velocity is Deprecated, and you should be using AssemblyLinearVelocity, use ApplyImpulse if you are trying to apply a force to an Object.

1 Like