PlatformStand is flinging after unragdoll

When I set PlatformStand to false, my Character gets flinged, I dont know why. Anyone got a solution for this?

Also ChangeState GettingUp does not work.

local module = {}
local Debris = game:GetService("Debris")

function sub(...)
	coroutine.wrap(...)()
end

return function(Character, Duration)
	if not Character or (Character and not (Character:FindFirstChild("Humanoid") and Character:FindFirstChild("HumanoidRootPart"))) then
		return nil
	end
	
	if Character:FindFirstChild("Ragdolled") then
		return nil
	end
	
	if not Character:FindFirstChild("Right Arm") or not Character:FindFirstChild("Left Arm") or not Character:FindFirstChild("Right Leg") or not Character:FindFirstChild("Left Leg") or not Character:FindFirstChild("Torso") or not Character:FindFirstChild("Humanoid") then
		return nil
	end
	
	local HumanoidRootPart = Character.HumanoidRootPart
	local Joints = {}
	
	local CreateJoint = function(Parent, JointType)
		local Joint = script.Part[JointType]:clone()
		Joint.Parent = Parent
		Joint.Name = Joint.Parent.Name.."Joint"
		
		local Connector = script.Connector:Clone()
		
		if not Joint.Parent.Parent:FindFirstChild("Torso") then
			return nil
		end
		
		Connector.Parent = Joint.Parent.Parent.Torso
		Connector.Attachment0 = Joint.Parent.Parent.Torso:FindFirstChild(Joint.Name)
		Connector.Attachment1 = Joint
		
		local ExtraJoint = Instance.new("IntValue")
		ExtraJoint.Name = "ExtraJoint"
		ExtraJoint.Parent = Joint
		
		ExtraJoint:Clone().Parent = Connector

		table.insert(Joints, #Joints+1, Joint)
	end
	
	sub(function()
		for i,v in pairs(script.Torso:GetChildren()) do
			if v.ClassName == "Attachment" then
				v:Clone().Parent = Character.Torso
			end
		end
		CreateJoint(Character["Right Arm"], "ArmJoint")
		CreateJoint(Character["Left Arm"], "ArmJoint")
		CreateJoint(Character["Right Leg"], "LegJoint")
		CreateJoint(Character["Left Leg"], "LegJoint")
	end)
	
	local Motors = {Character.Torso:FindFirstChild("Left Hip"), Character.Torso:FindFirstChild("Left Shoulder"), Character.Torso:FindFirstChild("Right Hip"), Character.Torso:FindFirstChild("Right Shoulder")}
	
	local MotorPoof = function(tf)
		for i,v in pairs(Motors) do
			if v.ClassName == "Motor6D" then
				v.Parent = nil
			end
		end
	end
	
	local MotorAdd = function()
		for i,v in pairs(Motors) do
			if v.ClassName == "Motor6D" then
				v.Parent = Character.Torso
			end
		end
	end
	
	MotorPoof()
	local CollisionBoxes = {}
	local Parts = {Character["Right Arm"], Character["Left Arm"]; Character["Right Leg"]; Character["Left Leg"]}
	
	for i, v in pairs(Parts) do
		local Box = v:Clone()
		Box.Transparency = 1
		Box.Massless = true
		Box.CanCollide = true
		Box.Anchored = false
		Box.Name = "CollisionBox"
		Box.Size = Box.Size - Vector3.new(.4,.2,.4)

		local Weld = Instance.new("Weld")
		Weld.Part0 = v
		Weld.Part1 = Box
		
		Weld.Parent = Box
		Box.Parent = Character
		
		table.insert(CollisionBoxes, #CollisionBoxes+1, Box)
	end
	
	local Humanoid = Character.Humanoid
	Humanoid.PlatformStand = true
	Humanoid.AutoRotate = false
	
	local Ragdolled = Instance.new("Folder")
	Ragdolled.Name = "Ragdolled"
	Ragdolled.Parent = Character
	
	local Stun = Instance.new("Folder")
	Stun.Name = "Stun"
	Stun.Parent = Character
	
	for i,v in pairs(Parts) do
		v.CanCollide = true
	end
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
	Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
	
	Humanoid.JumpPower = 0
	local StartTick = tick()
	while wait(.5) do
		Humanoid.PlatformStand = true
		Humanoid.AutoRotate = false
		MotorPoof()

		if Humanoid.Health <= 0 then
			break
		end

		if tick() - StartTick >= Duration then
			break
		end
	end
	
	if Stun and Stun.Parent then
		Stun:Destroy()
	end
	
	if Ragdolled and Ragdolled.Parent then
		Ragdolled:Destroy()
	end
	
	for i,v in pairs(Parts) do
		v.CanCollide = false
	end
	
	for i,v in pairs(Joints) do
		if v then
			v:Destroy()
		end
	end

	for i,v in pairs(CollisionBoxes) do
		if v then
			v:Destroy()
		end
	end
	
	if Character:FindFirstChild("Torso") then
		MotorAdd()
	end
	
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
	Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
	
	Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	Humanoid.PlatformStand = false
	Humanoid.AutoRotate = true
	Humanoid.JumpPower = 50
	
	return true;
end

I really need help, anyone got a solution?

Do you have a gif of this bug occuring? Does the player just flop around and takes a few to get up, but will? Or flat out just flings out of the area?

Nevermind, I fixed the issue with disabling some states on client.

what was the solution to this

Use the HumanoidSetStateEnabled function on the client (if a player) or the server (if its an NPC) and disable the ragdoll and fallingdown humanoidstate

2 Likes