Character falls over after custom knockback system fires

I’m working on a recreation of an old game I used to play which is now discontinued, and my concurrent “knockback” system does not allow the player to recover correctly, and makes the player fall over at the end. The falling over only happens in-game, not in studio.

The following code is what fires after you land

(the beginning of said lines listed are me trying to figure out how to fix the sudden slipping the line where I clear out all of “Velocities” is where the actual part where I slide backwards.)

	RootPart.AssemblyLinearVelocity =,0,0);
		RootPart.CFrame = CFrame.lookAt(RootPart.Position +,2.5,0),, RootPart.Position.Y + 2.5, Point.Z))
		local bodygyro ="BodyGyro")
		bodygyro.CFrame = RootPart.CFrame;
		bodygyro.MaxTorque =,math.huge,math.huge)
		bodygyro.D = 0
		bodygyro.P = 1500
		bodygyro.Parent = RootPart;
		local bodypos ="BodyPosition")
		bodypos.MaxForce =,math.huge,math.huge)
		bodypos.P = 1500
		bodypos.D = 0
		bodypos.Position = RootPart.Position;
		bodypos.Parent = RootPart
		RootPart.Anchored = false;
		if Humanoid then

		for i,v in pairs(Velocities) do

		local beginningtick = -56.50
		local bodyvel ="BodyVelocity")
		bodyvel.MaxForce =,0,math.huge)
		bodyvel.P = 12500
		bodyvel.Velocity = RootPart.CFrame.LookVector * beginningtick
		bodyvel.Parent = Character:FindFirstChild("Torso")

		repeat task.wait()
			local Rayca = workspace:Raycast(RootPart.Position + RootPart.Velocity / 5, RootPart.CFrame.LookVector * -8,param)
			if Rayca then
				bodyvel.Velocity = Direction * -Rayca.Distance
				bodyvel.Velocity = Direction * beginningtick
		until bodyvel.Parent == nil or bodyvel == nil or Humanoid == nil or Humanoid.Health <= 0 or Character == nil or Character.Parent == nil
		if bodyvel ~= nil then
		Humanoid.AutoRotate = true;

I’m aware that the code is a mess, but I’ll get to that part later.

So I see you set the HumanoidState to be Landed, what if you had a loop running in parallel that consistently set the humanoid to the Landed state after they have been flung? Also, I don’t know if this would change anything, but what if you manually set PlatformStand to true just before the knockback is applied?

Thank you, I added the humanoidstate change into a loop and made it toggle PlatformStand at the start and the end of the knockback, which fixed it.

1 Like

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