2D Plat Former Game Glitch

I’m making a 2D plat former style game and there’s one big issue I found.

It’s hard to word this out so I’ll try my best.

It happens when you’re holding down either A or D depending on direction your going. If there’s a wall you can hold down these buttons and jump. This begins to move the player in the directions that would normally either be W or S. What ends up happening is you fall of the map and die.

The only solutions I found are invisible walls which do keep you alive but is still buggy. I also thought of making a script which would reset the player’s x axis to only be at 0. The problem the x axis script is I wouldn’t know how to go about doing that.

Here’s how it would be normally:

Here’s how it is when you’re in the back:

Here’s how it is when you’re in front:

Here’s a video. I use various mechanics I made to perform the glitch. You can also see some custom animations. They aren’t the root of the problem though. When I used Roblox’s default R6 animations they still resulted in the same way.
robloxapp-20200622-1537425.wmv (1.3 MB)

1 Like

This can be resolved by using a BodyPosition to lock the player’s x axis. Parent the BodyPosition to the torso using a script.

1 Like

What I did was I put a BodyPosition into my player’s torso while testing the game. Then I flew up. I set D to 0 and MaxForce to 0,0,0 as well. I then fell.
I proceeded to then increase my X axis in MaxForce to 9999999980506447872. I then ran into a wall and did the same as I did before. I glitched out as before. I think I did it faster in fact.

Do I need to do it with a script for it to work? Or am I doing something wrong with the BodyPosition?

robloxapp-20200624-0234223.wmv (997.8 KB)

From the video it looks like BodyPosition wasn’t set up correctly. The issue is likely one of these things:

  • MaxForce is at 0
  • P set too low. Leaving it at its default is usually best.
  • D is too large. Should be 100 or less for this purpose.
1 Like