Making rocket jumping with gravity?

Hello! so I’ve made a simple “rocket jumping” system that moves your player in the opposite direction of your camera.

This is what I have so far.


As you may see in the video though, if you try flying upwards just after falling down at a great speed, you’ll immediately go upwards (contrary to slowing down, which is what I want to achieve. Essentially adding onto the player’s speed rather than setting it).

I’d like to do this without applying deprecated measures (e.g modifying the player’s Velocity property directly), and, frankly, I’m not sure what to do. Devforum hasn’t helped me much either.

I’d also like to know if there’s any properties to directly constrain a player’s Velocity (or to add a cap to it, so to speak).

This is my current code (in StarterChraracterScripts):

local UIS = game:GetService("UserInputService")
local DS = game:GetService("Debris")
local camera = workspace.CurrentCamera
local Magnitude = 100

local Attachment = Instance.new("Attachment")
Attachment.Parent = script.Parent.HumanoidRootPart

UIS.InputBegan:Connect(function(input,process)
	if input.KeyCode == Enum.KeyCode.E then
		local vel = Instance.new("LinearVelocity")
		vel.Parent = script.Parent.HumanoidRootPart
		vel.MaxForce = math.huge
		vel.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
		vel.VectorVelocity = camera.CFrame.LookVector * (Vector3.new(1,1,1) * -Magnitude)
		vel.Attachment0 = Attachment
		DS:AddItem(vel, 0)
	end
end)

Thanks in advance!

Maybe try adding the current AssemblyLinearVelocity of the HumanoidRootPart to the velocity. As for capping the speed, add another LinearVelocity and use the drag formula on it (see Google, I don’t know it by memory).

1 Like

Thanks!

thirtycharactersss

1 Like

What does the drag formula look in the code? I’m stupid and I kind of don’t know how to implement it.

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