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!