Hi,
how do I make a character jump forward when I press W?
Note really asking for code but I want to know the technique to do it.
Sincerely,
-coolguyweir
Hi,
how do I make a character jump forward when I press W?
Note really asking for code but I want to know the technique to do it.
Sincerely,
-coolguyweir
Just set the HumanoidRootParts’s AssemblyLinearVelocity to make it jump.
local LV = HRP.CFrame.LookVector
HRP.AssemblyLinearVelocity = Vector3.new(0,15,LV * 15)
can you please explain to me what assembly linear velocity is
I applied the lines to character humanoidrootparts in a local script, but nothing happened…
UIS.InputBegan:Connect(function(input, GPE)
local LV = humanoidrootpart.CFrame.LookVector
humanoidrootpart.AssemblyLinearVelocity = Vector3.new(0,500,LV * 500)
print("reached")
end)
Can you please take a look?
AssemblyLinearVelocity is just the velocity of a part. It’s also a replacement for .Velocity
as it is deprecated.
Ok, so you want it only to happen on W, but you are making it happen on every input.
UIS.InputBegan:Connect(function(input, GPE)
if GPE then return end
if Input.KeyCode == Enum.KeyCode.W then
local LV = humanoidrootpart.CFrame.LookVector
humanoidrootpart.AssemblyLinearVelocity += Vector3.new(0,25,LV * 25)
-- Forgot this part, but its supposed to add the velocity not set it. Also 500 is a REALLY big number, you should try 25.
print("reached")
end
end)
Edit : You should probably do this on the server using remote events.
ya I know to do that
but later I figured what happened
In the beginning I had another method to do it, involving changing the player’s movement type to scriptable meaning all default movement is disabled, which means your method wouldn’t work.
But I turned that off and it kinda works now.
Thanks!
you can also use “:ApplyImpulse()” to apply a force on the humanoidrootpart.
say I wanted to make it jump forward 6 studs. How would I do that?
humanoidrootpart.AssemblyLinearVelocity = (LV * 6) + Vector3.new(0,6,0)
Can you please explain this statement
I don’t get the code
The LV
is the LookVector
of the HRP
. LookVector
means the direction it is facing in, if it is orientated 45 degrees to the right, it would probably be something like [0.5,0,1]
. Then multiplying it by 6 would make it become something like [3,0,6]
. So now that would be the direction the player is launched towards.
Then we added a Vector3
to also launch the player in the Y
axis
Lastly, we set the HRP
's AssemblyLinearVelocity
to the “direction” the player will launch into.
it’s not really working…
it barely jumps and it barely moves. just like 0.1 studs.
if it’s not jumping far enough, apply more force so change 6 to a bigger number
I changed it but it’s not jumping exactly 6 studs…
how do I make it jump EXACTLY 6 studs
If you need it to be EXACTLY 6 studs. Try using Bézier curves. The downside is that they don’t work with Roblox’s physics engine.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.