How to disable climbing?

Hi, I’m making a game based around platforming, and well, you’re kind of able to climb on the ledges of thin platforms, which is undesirable, anyone know how to just, disable climbing?

7 Likes

Player.Character.Humanoid:SetStateEnabled(12,false)

That should disable climbing completely

9 Likes

Thanks!

1 Like

No problem, glad I could help.

Using numbers for enums can make your code hard to read and hard to maintain. It obscures what the given code is actually doing and makes it look like magic, especially if you don’t add a comment explaining its purpose.

This makes more sense at a glance and looks less like magic. It will make your game easier to maintain in the long run.

Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
58 Likes

To add onto this, numbers (in this context) confused me when I was learning to script. When I first learned about properties that used enums, I had a hard time wrapping my head around how I’m supposed remember or even know which numbers to use. It all made so much more sense when I learned more what enums were.

6 Likes

Be sure to mark the post as the solution so people don’t start replying to a post that’s already solved.

3 Likes

Additional note - with filtering enabled on the SetStateEnabled has to be on the client as that’s where the character movement is owned.

(Something I only figured out Just Now, even though I’ve been doing this for almost two years.)

8 Likes

I’m pretty sure it has to be set on both the client and the server. Or maybe that’s only the case with the death state Enum.

Seems to work for me on just the client

2 Likes

Mostly I made the comment to help future me’s who search the forum and this is the first thread they find

4 Likes

i know putting a humanoid into a truss makes it unclimbable, might also work with just any old part.

1 Like

it wouldn’t work with other parts, either way, that’s a pretty… bad way to do it?

4 Likes

where do I need to insert this

Casual bump after 5 years but anyways, you would put it in a local script within a container where local scripts can be run, the code is pretty self explanatory

1 Like