Player getting stuck in the wall

Hello! I am making a slide system but when I get close to a wall, the players legs get stuck inside it.

How do I fix this?

code:

Character.Humanoid.HipHeight = -2

				print("sliding")

				IsSliding = true

				CurrentSlidingTrack = Humanoid:LoadAnimation(SlideAnim)

				SmokeParticles = script.Smoke:Clone()
				SmokeParticles.Parent = Torso

				HumanoidRootPart.CanCollide = false
				Character.Head.CanCollide = false

				BodyVelocity = Instance.new("BodyVelocity")
				BodyVelocity.Parent = Character.HumanoidRootPart

				SlideSound:Play()

				CurrentSlidingTrack:AdjustSpeed(2)
				CurrentSlidingTrack:Play()

				timer = 0.25
				deltaTime = 0
				
				if Humanoid.MoveDirection.X == 0 and Humanoid.MoveDirection.Y == 0 and Humanoid.MoveDirection.Z == 0 then
					BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 23
				else
					BodyVelocity.Velocity = Humanoid.MoveDirection * 23
				end

				coroutine.wrap(SetHeight)()

				repeat wait()
					BodyVelocity.MaxForce = Vector3.new(Humanoid.WalkSpeed / 16, 0, Humanoid.WalkSpeed / 16) * 30000
					timer -= deltaTime

					game:GetService("RunService").Heartbeat:Connect(function(delta)
						deltaTime = delta
					end)
				until timer <= 0 or EPressed == false

				if IsSliding then
					StopSliding()
				end
1 Like

Maybe move their character down on the y-axis (-y)?

1 Like

Then they would be able to clip thru floors in certain cases.

2 Likes

Hmm uhhh there’s no other logical solutions I can think of. Have you tried making the slide gap larger and seen if it works?

Ehhhh won’t people be able to walk thru then?

Like I guess you could set a certain character height and keep trying until you find the right height so that they can slide but cant jst walk on thru

nvm setting the torso to cancollide false worked, thanks for trying to help tho.

Incase this ever gives any problems, I think lowering the hipheight would be a good alternative.
(Humanoid.HipHeight)

edit: I noticed you are already lowering the hipheight in your script, you can try lowering it even further because in your video it looks like it is still slightly too high.

like i said, setting the torso to be cancollide false worked.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.