Humanoids Trip When Mounting Horses

So I am making a MOBA on Roblox and a recent bug I encountered with my simple mount script is that when the player mounts, sometimes the humanoid will trip and stay in a trip state and are stuck for a minute. Originally I had thought it was a different issue because the player looked like they were standing fine but the humanoid is definitely tripping. I was wondering if there is a better way to go about attaching a horse to my character. Currently I am just offsetting the hip height of the humanoid so it looks like they are on top of the horse. Each mount model is controlled by an AnimationController not a humanoid.

Here is my current code for more information:

function Mounting.LoadMount(human)
	local Configuration = human.Parent:FindFirstChild('Configuration')
	local playerOffset = Configuration.PlayerOffset.Value
	local mountHipHeight = Configuration.MountHipHeight.Value
	
	
	local player = game.Players:GetPlayerFromCharacter(human.Parent)
	local mountId = playerMounts[player]
	local mountData = getMountDataFromMountId(mountId)
	
	local mount = mountData.figure:Clone()
	local mountOffset =  mount.Configuration.MountOffset.Value
	local customOffset = Configuration:FindFirstChild('CustomOffset_'..mountId)
	
	mount.Name = player.Name	
	mount:SetPrimaryPartCFrame(human.Parent:GetPrimaryPartCFrame())
	    
    local motor = Instance.new('Motor6D')
    motor.Part0 = mount.PrimaryPart
    motor.Part1 = human.Parent.HumanoidRootPart
    motor.C0 = (CFrame.new(mount.PrimaryPart.SitAttachment.Position) 
							+ playerOffset + mountOffset + (customOffset and customOffset.Value or Vector3.new(0,0,0)))
    motor.Parent = mount.PrimaryPart
	mount.Parent = mountsFolder
	human.HipHeight = mountHipHeight + mount.Configuration.HipHeightOffset.Value
	return mount 
end

Thanks, Anne.

Try using SetStateEnabled(). This is a function of the humanoid object that prevents the humanoid from entering specific states, like PlatformStanding.

In your case, something like

humanoid:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)

Might do the trick! Just call that when they sit (or right before they sit).

You might need to call it on both the client and the server (if it’s anything like the dead state).

How would setting platform standing to false fix the issue? Isn’t platform standing what they need? Or does it cause the player to trip more?

On Roblox, that is a term for the user “falling” unexpectedly, completely losing control. Try setting the property for it it to true on your humanoid to see what I’m talking about. It’s hard to describe.

Basically, you don’t want that to be triggered when you sit on the horse, if that’s happening at all.

I know I can’t explain it that well, but you should try my solution anyway and see if it works :slight_smile:

PlatformStanding was actually created for Skateboards many years ago, the behavior of completely losing control when the PlatformStanding state is entered is just a side effect of this state disabling things like the humanoid raycasting to find a floor and hovering above it. It might actually be worth setting PlatformStand to true to enter this state for something like mounts.

The FallingDown or Ragdoll states are the states that the Humanoid will enter when tripping.

4 Likes

I always wondered why that was a thing…

So actually disable

Enum.HumanoidState.FallingDown

And that might help :slight_smile: