Building a climbing system

I know nobody is gonna write one for me, nor do I want anyone to.
I just need some guidance on how to actually pull this off.

I want to be able to write system where players can climb on walls, moving up down left & write.

How do I even start this? Any advice is helpful
Yes I’ve seen most of the YouTube videos but they didn’t do much for me.

2 Likes

Can you be more specific?
Climbing system how?
I would be glad to help.

You can make walls climbable by placing invisible trusses. Now how to do left and right, you may have to alter some gravity physics.

I would do something like check if an object is in front of a player. If the object is in front of a player, check if there is enough space on the objects surface to climb. If there is enough space to climb then put the player into climbing mode. In climbing mode move the player on the surface of the wall in the specified direction. You could use ray normals or something to make sure the player stayed oriented to the walls face. From there just play the dif animations for moving and idle.

Similar to that of rogue lineage

Climbing like this, but also including being able to move left, right, & to be able to climb on slopes.

Any advice isn’t too little. Thank you

This may be dumb to ask but I didn’t know you could manually change a players mode for climbing like that.

So for making sure a wall exists, that would mean raycasting correct?

Yes I mean raycasting. You could also use workspace :getpartsinarea(might not be exact name i forgot). And there is not a manual way for you to switch on
“climbing mode”. This would just be a value you switch on that tells your code to start making player climb.

Can you put a sample line of code for an example? Sorry.

Well i mean I aint giving you a free script, gotta pay my comission fees for that.
I will however give u a layout.

–Check if wall good to climb on is next to player
–Switch on climbing mode(could just be connecting climbing code to stepped)
–Get surface
–Move along surface

I’d pay for a full lesson if that’s ok

Sure would be nice to see your work. My dizzy is comingDev#9178

You will need to check if there is a wall in front of your character on every frame. Then you need to act accordingly to get the climbing functionality that you want.

Here is some pseudo-code. I have not tested it, but if all you have to do is set a climbing state, then this might do the trick. If you do not understand some parts of the code, then I recommend you to read ROBLOX’ documentation first.

-- This code in client-sided!

local function isWallInFrontOfCharacter()
    -- Do a raycast from the head in the direction of the head's look vector
    -- Return true if the raycast hits anything in a vicinity of say 1 stud
end

local function startClimbing()
    -- Check if the humanoid is climbing with Humanoid:GetStateEnabled
    -- If the humanoid is not climbing, set the climbing state to true with
    -- ... Humanoid:SetStateEnabled
end

local function stopClimbing()
    -- Check if the humanoid is climbing with Humanoid:GetStateEnabled
    -- If the humanoid is climbing, set the climbing state to false with
    -- ... Humanoid:SetStateEnabled
end

RunService.Stepped:Connect(function()
    if isWallInFrontOfCharacter() then
        startClimbing()
    else
        stopClimbing()
    end
end)

Other bro’s terrible answer that doesn’t work by @Brickman808 made me want to give you a solid pseudo code explanation.

This will be the process of climbing

Process:

  • Check if a wall is in front of the player and raycast from the bounds of the player to see if it is climbable.

  • If the wall is climbable then raycast the wall from every degree between 0 and 360.(or 1 -360), Starting from the bottom of the part. (note, this should be aligned to the upvector of the objects cframe.)

  • Repeat this step along the objects y axis(up vector)

  • Store all of the surface normals and positions of these raycasts in a table. Each y increment will hold its own table full of x increments(360 degree around).

  • Whenever a player starts climbing around you find what the next increment is.

  • ← and → will just change the node to whatever is right or left in the table of x increments

  • Up and Down will change the node to the node set of x increments right or left (remember the y increments hold x increment data so moving left is moving up and moving right is down).

  • Take whatever the new node is and lerp to it from current node or just set it as is(you prob want to do this if your walls are curved as well as creating lots of nodes)

  • Set the position of the player to that node and use IK controls to force their hands onto the wall. Make player CFrame surface normal(this makes player face away from wall)

And there you go a much more in depth explanation that will actually work!

Definitions:
Surface Normal : This is just the orientation of a surface. It’s like what direction surface is facing
Node : A table containing a position and surface normal
Node Set : A table of nodes that all share the same amount of elevation along the objects upvector.

This system will allow for movement along curved walls, flipped walls, really anything.

2 Likes

By the way you should know SetStateEnabled won’t make something start climbing. I believe it only plays an animation.

1 Like

Well, pseudo-code is not going to work by nature. So that is no surprise I guess. What I tried to achieve was to steer the questionnaire in the right direction by keeping it simple without filling in all the blanks. After all, an unexperienced scripter would struggle immensely with matters like inverse kinematics.

I do agree about my answer being terrible. That is because this stuff has already been done before. The topic contains quite a few code samples along with some good ideas on how to implement climbing.

1 Like

That isn’t quite as smooth as what mine would do but ok. And by not work I meant that after filling in the blanks it would’t work. You wrote animation pseudo code, not climbing pseudo code. Climbing pseudo code would’ve been fine cuz thats the question.

This should help:

You can move sideways, and up and down on ledges.

2 Likes