Unpredictable character physics

What is the issue?

We have a script that will launch players when they perform certain actions, however, sometimes when the player lands the game physics will cause the player to uncontrollably spin / shoot off the map.

What solutions have you tried so far?

We have tried adjusting the materials that the players land on, but it does not fix the issue. The issue appears to be intermittent, where sometimes it happens and sometimes it does not.

Code sample below - is there anything obviously wrong with this that will cause issues with the player landing?

bodyVelocity.Velocity = Vector3.new(xLaunchVelocity,yLaunchVelocity,zLaunchVelocity)
bodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bodyVelocity.P = math.huge
bodyVelocity.Parent = character.HumanoidRootPart
wait(launchTime)
bodyVelocity:Destroy()

Try replacing math.huge with something like 40,000. Sometimes massive numbers like that can cause some serious physics spasms on collisions.

If the players are getting flung when they hit the ground, try disabling the FallingDown humanoid state on each player

Thanks for the responses everyone.

@jacys23 I didn’t understand the first time you wrote this, but are you referring to when a player collides with something and they are “flung” or spinning on their side almost? That’s a good idea to temporarily disable the falling state. The problem we had was players could actually fall straight through certain parts that they should be colliding with (or getting their character halfway stuck through a part) depending on server lag conditions.

As an update for future readers, we were never able to find a workaround to this so we reworked our game to remove the code in question. The problem didn’t happen very frequently, but seemed to happen more when the player had a high ping.