Is there a way to 'restrict/ban' the ability to climb?

I’m just wondering if it’s possible to prevent player’s from climbing/mounting objects without using an invisible block?

3 Likes

You could try this:

local humanoid = -- path to humanoid
humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)

No, unfortunately that didn’t work!

Put this in a ServerScript, inside of StarterCharacterScripts:

local humanoid = script.Parent:WaitForChild("Humanoid")
humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)

That’s what I did. Did not work!

Are there any errors in the output?

Nope. Nothing unfortunately. Has it worked for you?

-- LocalScript @ StarterPlayerScripts
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid", 10)

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

LocalScripts run only under certain containers, one of them being StarterPlayerScripts.
Call WaitForChild to ensure the humanoid is indexed after it exists, and the script doesn’t break.

2 Likes

Did some research here and realized that it needs to be a LocalScript inside of StarterPlayerScripts:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
2 Likes

Haven’t tested this script to see if it works, but I can tell you it’s a very performance heavy script, not something I would recommend

1 Like

Would you recommend just altering all the map with climbing prone areas?

1 Like

I think so, yeah. From what I can find humanoid’s and their states are quite finicky. Modifying the map with some invisible parts blocking the climbable areas should do the trick.

Do this on the server, logically only do this if your game doesnt let you climb at any circumstances.

And put it in the server script storage or in workspace so it can work.

game.Players.PlayerAdded:Connect(function(player)
       player.CharacterAdded:Connect(function(character)
              local hum = character:WaitForChild("Humanoid")
              hum:SetStateEnabled("Climbing", false)
       end)
end)

Pretty sure that :SetStateEnabled() just disables a state if it is currently enabled, rather than disabling the humanoid from ever changing to that state.

@Pez1999 I’ve come up with a script that stop players from climbing by having them “lose their footing” (fall) if they try and climb up anything. This doesn’t work for short climbs, but stops players from scaling walls.
Here’s a gif:
https://i.gyazo.com/709aecc383ba3964679a4b1d01106fcb.mp4

And here’s the source code:
https://pastebin.com/raw/NjvYyFg1

If that was the case, could he just do this?

humanoid.Climbing:Connect(function()
    humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
end)
1 Like

In testing I found that this is not enough. I’m not sure why this is, but it looks as if once the player has started climbing the state doesn’t matter, the player will continue to climb. Likely this is because the climbing mechanics are handled entirely separately.

1 Like

Oh ok, thanks for letting me know :+1:

1 Like