Best way to disable freefall

What I think you have to do is:
Check if the arm of the player is touching a part from the upper side, if no, then di nothing, if yes, then free fall equals false, so that the player can jump, that’s just a rough sketch, but that’s what I think you need


The player slides off.

Like this, he explained it in another topic: Sliding effect on Freefall

If I disable freefall, the player would be unable to move.

Can you disable free fall but enable the walking state?

Well, you could spawn parts around the character when it is falling? And disable the arms collision

Or maybe make a function that checks if the long arm is on a part and if yes when you press space it makes you jump, much like double jumping

Like this?

humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, true)

Something like that, already told you, I’m not a scripted so don’t ask me the code,

The player still wouldn’t be able to move.

Is there a different way of disabling freefall without using SetStateEnabled?

Then sorry I have no idea :frowning_face:
Character

I found that linear velocity can fix it.

I actually fixed it! After days trying to solve this, I finally came to a solution!

Insert a LinearVelocity in the RootPart and set VelocityConstraintMode to Line.
Insert an attachment in the RootPart and set LinearVelocity Attachment0 to the attachment.

Put this code in a local script and put the local script inside StarterGui.

local player = game.Players.LocalPlayer
local velocity = 5 -- set this to the speed you want the player to move

RunService.Stepped:Connect(function()
	local character = player.Character

	if character and character.PrimaryPart then
		local humanoid = character:WaitForChild("Humanoid")
		local linearVelocity = character.PrimaryPart:FindFirstChildWhichIsA("LinearVelocity")

		local linearVelocity = character:FindFirstChildWhichIsA("LinearVelocity")

		if linearVelocity then
			if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
				linearVelocity.LineDirection = Vector3.new(humanoid.MoveDirection.X,0,humanoid.MoveDirection.Z)

			elseif humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
				linearVelocity.LineDirection = humanoid.MoveDirection
			end

			if humanoid.MoveDirection == Vector3.new(0,0,0) then
				linearVelocity.LineVelocity = 0
				linearVelocity.LineDirection = Vector3.new(0,0,0)
				linearVelocity.Enabled = false
			else
				linearVelocity.LineVelocity = velocity
				linearVelocity.Enabled = true
			end
		end

		humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
	end
end)

You. Are. A. Literal. Genius. but there’s a problem, wouldn’t this make it so when you are free falling you would not be able to move anymore? Meaning you could jump but not go in any direction with the jump? Not sure but that’s what I see, you should add a function that checks if the arm is over the part and then runs the script, good job by the way :smiley: and you forgot to mark your reply as the solution

No, you can still be able to move. Using LinearVelocity can make the player move.

From my understanding, this seems like some sort of broken bones movement system.

However, wouldn’t this still prevent the player from getting up?

humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)

Wow that’s effectively a smart solution :bulb:

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