How to create quicksand?

As in the title, I want to create quicksand that slowly drags players down while they are in it, as well as affect their jumping physics such that they can spam jump to slowly get out of the quicksand. How can I make it?

2 Likes

I would try something like this to see how it looks:

  • When player is close to the quicksand pit, freeze it, anchor the player/freeze it in place.
  • Control its Y position by server script and the inputs (efforts player does sent from client)
  • Play an idle animation of being drag struggling.
  • When player inputs is jump play another animation that seems like player is trying to go out.
  • Jump event received on server to control its Y position.
  • When player reach a threshold it will be allowed to leave the quicksand pit, meaning giving back the player the chance to move again (unachor it).
  • Sanity checks etc to ensure they dont hack the quicksand mechanics

Just a few first ideas about from where I would start an approach

2 Likes

As they enter quicksand, disable the normal jump state. Disable their collision with Terrain, and continuously lower their velocity while they’re sinking so that they don’t immediately fall through the world. Do a few raycasts to make sure they don’t sink too far and fall through the world. Increase their vertical velocity when they hold the jump button. When they get out of sand, re-enable their normal jumping and collision.

You can also add some sand particles, and make the player’s screen turn a dark sand colour when the looking under the sand if their player sinks below the sand surface.

This seemed like a good exercise, so I tried it myself:

1 Like

Not sure how to do that, i’m not exactly a master at scripting. How do you lower their velocity?

Edit: I read your script in the game you created, and I was wondering how to add a script to the part I am using for the quicksand, as I want the code to run when the player is touching that part, not a piece of terrain.

1 Like

You could use workpace:GetPartBoundsInBox with the filter set to only check for the part you want. The function gives you a list of parts that are touching a box that you can specify with a CFrame for it’s position and rotation and a Vector3 for it’s size.

I actually tried to use this for my own attempt, but it doesn’t seem to be able to detect Terrain :frowning: I’ll have to check back on that.

You should be able to “detect” the name of the part. Make things a lot easier. Part name quicksand.
Great script btw. Love the brown screen at the end. It’s like the cherry on top of a good effect.

1 Like

They could have a folder and use the filtering parameters:

local FilterParams = OverlapParams.new()
FilterParams.FilterType = Enum.RaycastFilterType.Include
FilterParams.FilterDescendantsInstances = {workspace.QuicksandParts}

So it’ll only give a result if it hits a part parented to a QuicksandParts folder in workspace.

P.S.: The brown screen isn’t the “end”, you can use the Space key to get back out : )

EDIT:

That’s why it’s uncopylocked!

I really think I overcomplicated things, but thanks : )

I ran a few tests… ended up peeking at your script and, Oh my… I think I’ll leave this one to you :joy:.
When I saw the brown screen I laughed, just too good. You really go all out for an effect. o7
Maybe make the sand flying up smaller is the only thing I saw that could be improved.

1 Like

Definitely considering using forces. It’s more manipulatable. Change the jumppower and walkspeed to a lower value, and use VectorForce to apply a constant velocity downwards, but cap it out at a certain velocity downwards (:Min()), like 1 stud/ps. Your jumps will very short, and you fall slowly. Hope this helped.

Try it out, I have a good feeling about it.