I was trying to make a simple lunge script to simulate a really long, low jump. When I am on the ground and I press Reload it makes the player barely move forward and is not getting the intended effect, but if I press reload and jump right after I press it, it works as intended. I am getting no errors.
[lua] function Lunge(ply)
if ply:GetStaminia() > 30 then if ply:KeyDown( IN_RELOAD ) && ply:OnGround() then ply:SetVelocity( ply:GetForward() * 200 + Vector( 1, 1, 150 ) ) ply:SetStaminia(ply:GetStaminia()-30) end else return end end hook.Add("KeyPress", "Lunge", Lunge)