Making Character Stay Midair

Hi, I am making a combat system, and it’s pretty annoying to combo midair if you keep falling. So I want to make the character stay midair while comboing .
I’ve tried using the good ol’ Body Velocity but it keeps being replaced by the original body velocity that’s meant to move the player a bit when attacking

Here’s how i try to create the body velocity, please tell me if you need the whole script

			local bv = Instance.new("BodyVelocity", data.Character.HumanoidRootPart)
			bv.Velocity = data.Character.HumanoidRootPart.CFrame.LookVector * 10
			bv.MaxForce = Vector3.new(99999, 99999, 99999)
			bv.Name = "Velocity"
			game.Debris:AddItem(bv, .2)

			local ag = Instance.new("BodyVelocity", data.Target.HumanoidRootPart)
			ag.Velocity = data.Character.HumanoidRootPart.CFrame.LookVector * 10
			ag.MaxForce = Vector3.new(99999, 99999, 99999)
			ag.Name = "Velocity"
			game.Debris:AddItem(ag, .2)
			
			local bv = Instance.new("BodyVelocity", data.Character.HumanoidRootPart)
			bv.Velocity = CFrame.new(0,0,0)
			bv.MaxForce = Vector3.new(99999, 99999, 99999)
			bv.Name = "AntiGravity"
			bv.P = 9000
			game.Debris:AddItem(bv, 1)

			local ag= Instance.new("BodyVelocity", data.Target.HumanoidRootPart)
			ag.Velocity = CFrame.new(0,0,0)
			ag.MaxForce = Vector3.new(99999, 99999, 99999)
			ag.Name = "AntiGravity"
			ag.P = 9000
			game.Debris:AddItem(ag, 1)

I also tried to override the velocity of the pre-made body velocity, it kinda works except for the fact that it still falls after a split second. It also overrides the forward movement of other hits.

local bv = Instance.new("BodyVelocity", data.Character.HumanoidRootPart)
			bv.Velocity = data.Character.HumanoidRootPart.CFrame.LookVector * 10
			bv.MaxForce = Vector3.new(99999, 99999, 99999)
			bv.Name = "Velocity"
			game.Debris:AddItem(bv, 1.2)

			local bv2 = Instance.new("BodyVelocity", data.Target.HumanoidRootPart)
			bv2.Velocity = data.Character.HumanoidRootPart.CFrame.LookVector * 10
			bv2.MaxForce = Vector3.new(99999, 99999, 99999)
			bv2.Name = "Velocity"
			game.Debris:AddItem(bv2, 1.2)
            wait(.2)
            bv.Velocity = Vector3.New(0,0,0)
            bv2.Velocity = Vector3.New(0,0,0)

1 Like

I would recommend adding a LinearVelocity to the HumanoidRootPart instead. This will actually force the AssemblyLinearVelocity to a specific value instead of applying a force to the character. Alternatively you can do AlignPosition.

Both require you add an Attachment to the HumanoidRootPart and set the Attachment on the AlignPosition or LinearVelocity to that new attachment.

You’ll also want to manipulate the MaxForce of them and for AlignPosition you’ll want to set the Position property to the HumanoidRootParts position, and set RigidityEnabled to true.

But basically

local attachment = Instance.new("Attachment")
attachment.Name = "SuspendedInAirAttachment"
attachment.Parent = data.Target.HumanoidRootPart

local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.MaxForce = 999999999
linearVelocity.Attachment0 = attachment
linearVelocity.Parent = attachment

or

local attachment = Instance.new("Attachment")
attachment.Name = "SuspendedInAirAttachment"
attachment.Parent = data.Target.HumanoidRootPart

local alignPos= Instance.new("AlignPosition")
alignPos.MaxForce = 999999999
alignPos.Attachment0 = attachment
alignPos.RigidityEnabled = true
alignPos.Position = data.Target.HumanoidRootPart.Position
alignPos.Parent = attachment
1 Like

Hey sorry for the late reply,

I haven’t tried those methods before, might try it in a while cuz im kinda busy
I’ll mark your post as solution if it works

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