How to make the player stay in the air?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I have a dash system, and I want to make it so if you jump then dash, it keeps you in the air during the dash.

  1. What is the issue? Include screenshots / videos if possible!

I have tried to locally set the workspace’s gravity lower to try and keep the player from falling, but this yields inconsistent results with some dashes sending you higher and some keeping you lower.

UIS.InputBegan:Connect(function(i,t)
	if t then return end
	if i.KeyCode == Enum.KeyCode.Q then
		if not candash then return end
		workspace.Gravity = 20 --very low gravity
------------
		local Data = {
			["Action"] = "Dash",
			["Direction"] = CurrentDirection
		}
		Remotes.MainCombat:FireServer(Data)
--sending stuff to the server which will move the player^
		candash = false
		task.wait(.9)
		workspace.Gravity = 196.2--setting the gravity back to normal
		task.wait(.1)
		candash = true
	end
end)

Is there any way to do this that will always have the player stay in a straight forward line through the dash and then have them land after?

6 Likes

What are you using for the dash? Are you tweening the HumanoidRootPart or are you using a force?

1 Like

I’m using a BodyVelocity

local HumanoidRootPart = Character.HumanoidRootPart
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge, 0, math.huge)
BodyVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * Power
BodyVelocity.Parent = HumanoidRootPart
task.wait(.3)
BodyVelocity:Destroy()
1 Like

Does “CurrentDirection” include rotational values that could launch players up instead of a straight line? For example, if the player turned the camera so that it were looking up at the sky, would your code launch them up?

Edit: I took a better look at your code and I would suggest breaking the BodyVelocity.Velocity down into the individual Vector3 values and making sure that the Y value is zero so that the height isn’t affected

3 Likes