Introduction:
sup everyone
For a platformer game I made called velocity: Velocity - Roblox. Part of it has a jumping system called: Velocity-Cut Jumping which is the system i’m talking about and giving away
What is Velocity-Cut Jumping:
Velocity-Cut Jumping is a term used by 3D platformer developers more outside of roblox which is a system where instead of jumping at a set hight you can control the hight of your jump with how long you hold the jump button:
Why you should use it:
For platformer games it gives more depth and more control and has been used in games as far back such as the original Super Mario Bros if you have noticed
Source:
Game: Velocity-Cut Jump System - Roblox
Script & Settings:
Script:
wait(1)
local UIS = game:GetService("UserInputService")
local runserv = game:GetService("RunService")
local char = script.Parent
local humanoid = char.Humanoid
local HRP = char.HumanoidRootPart
local JumpVal = script.VelCut
local VelCutStopAmount = 2.5
local MaxJumpHight = 50
local attach1 = Instance.new("Attachment")
local attach2 = Instance.new("Attachment")
local trail = script.Trail
jumpsleft = 2
local function traill()
trail.Enabled = true
trail.Lifetime = 0.5
attach1.Parent = HRP
attach2.Parent = char.Head
trail.Parent = char
trail.Attachment0 = attach1
trail.Attachment1 = attach2
wait(0.3)
trail.Enabled = false
end
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Space then -- when player presses the jump button
if jumpsleft == 1 then -- When you double jumped or however you set it to
script.Sound:Play()
spawn(traill)
end
if jumpsleft > 0 then
jumpsleft = jumpsleft - 1
for i = MaxJumpHight,0,-10 do
JumpVal.Value = i
HRP.AssemblyLinearVelocity = Vector3.new(HRP.AssemblyLinearVelocity.X,JumpVal.Value,HRP.AssemblyLinearVelocity.Z) --making it so the jump value applies to player velocity
wait(0.08)
if not humanoid.Jump and humanoid.FloorMaterial == Enum.Material.Air then -- when player does not hold the jump button in the air
JumpVal.Value = JumpVal.Value / VelCutStopAmount
HRP.AssemblyLinearVelocity = Vector3.new(HRP.AssemblyLinearVelocity.X,JumpVal.Value,HRP.AssemblyLinearVelocity.Z) --making it so the jump value applies to player velocity
break
end
end
end
end
end)
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
jumpsleft = 2 -- Set this to the jumps left variable at the top of the script
end
end)
Variables, Numbers and Stuff:
Most of the variables are just refrencing but I will be talking about the important numbers and stuff. So tinker away as you will
local VelCutStopAmount = 2.5
this variable controls how hard you want the velocity to cut once you let go of the jump button when you jump mid air. Note that this value is using division in the script so if you set it to 0 it will just immedietly cut so set it 1-10: JumpVal.Value = JumpVal.Value / VelCutStopAmount
local MaxJumpHight = 50
Self explanitory but yes its the max hight of your jump
jumpsleft = 2
The number of jumps you have left. So if you set it to 1 you can only jump once do 2 you can double jump, 3 you can triple jump, so on so fourth.
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
jumpsleft = 2 -- Set this to the jumps left variable at the top of the script
end
end)
Note that if you change the jumpsLeft variable you have to change this variable changing thing to the JumpsLeft variable at the top of the script
for i = MaxJumpHight,0,-10 do
JumpVal.Value = i
HRP.AssemblyLinearVelocity = Vector3.new(HRP.AssemblyLinearVelocity.X,JumpVal.Value,HRP.AssemblyLinearVelocity.Z) --making it so the jump value applies to player velocity
task.wait(0.08)
Not a variable but I would still like to bring it up cuz I think its still important. So the custom Jump
System is really just a for loop, so you can change the speed of jump and loop by changing the wait number and also the -10 number
Things to Note:
This script only works on PC but I might script it for all devices, And also there is a bug where sometimes when you try to jump high your character instead jumps low and I think the reason is that roblox’s engine isnt perfect and doesn’t always detect when you are holding jump or not, but Lmk if there’s any other bugs or just give feedback about anything. And thxxx!