Unragdolling the player teleports them

  1. What do you want to achieve? Keep it simple and clear!
    Unragdolling without issue
  2. What is the issue? Include screenshots / videos if possible!
--Counter script
local module = {}

function module.Attack(character,echaracter,value)
	
	if value.Value == "SansCounter1" then
		
		local ragdollmodule = require(game.ReplicatedStorage.Ragdoll)
		local stun = require(game.ReplicatedStorage.Damage)
		character.Attacking.Value = true
			
		stun.stun(echaracter,-1)
		
		echaracter.Humanoid.AutoRotate = false
		local tweenservice = game:GetService("TweenService")
		local info = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
		local tween = tweenservice:Create(echaracter.HumanoidRootPart,info,{Position = character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 10 + character.HumanoidRootPart.CFrame.UpVector * 5})
		tween:Play()
		tween.Completed:Wait()
		local knockback = Instance.new("BodyVelocity")
		knockback.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		knockback.Velocity = Vector3.new(0,0,0)
		knockback.Parent = echaracter.HumanoidRootPart
		task.wait(5)
		delay(0,function()

			ragdollmodule.Start(echaracter)
			task.wait(2)

			ragdollmodule.Stop(echaracter)

		end)
		echaracter.Humanoid.AutoRotate = true
		character.Attacking.Value = false
		stun.stun(echaracter,2)
		knockback.Velocity =  character.HumanoidRootPart.CFrame.LookVector * 30
		echaracter.Humanoid:TakeDamage(10)
		game:GetService("Debris"):AddItem(knockback,0.1)
	end
end

return module

local ragdoll = {}
-- ragdoll script
function ragdoll.Start(character)
	if character.Ragdoll.Value then return end
	character.Ragdoll.Value = true
	
	for i, joint in pairs(character:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a0 = Instance.new("Attachment")
			local a1 = Instance.new("Attachment")
			a1.Name = "ragdolled"
			a0.Name = "ragdoleed1"
			a0.Parent = joint.Part0
			a1.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a0
			socket.Attachment1 = a1
			a0.CFrame = joint.C0
			a1.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true

			joint.Enabled = false
		end
	end

	character.Humanoid.WalkSpeed = 0
	character.Humanoid.JumpPower = 0

	character.Humanoid.PlatformStand = true

	character.Humanoid.AutoRotate = false
end

function ragdoll.Stop(character)

	local hrp = character:FindFirstChild("HumanoidRootPart")
	local hum = character:FindFirstChild("Humanoid")
	if hum.Health > 0 then
		for i,v in pairs(character:GetDescendants()) do
			if v.Name == "ragdolled" or v.Name == "ragdoleed1" then
				v:Destroy()	
			
			end
		end
	
	hum.PlatformStand = false

	for i, joint in pairs(character:GetDescendants()) do
		if joint:IsA("BallSocketConstraint") then
			joint:Destroy()
		end

		if joint:IsA("Motor6D") then
			joint.Enabled = true
		end
	end

	character.Ragdoll.Value = false
	
	hum:ChangeState(Enum.HumanoidStateType.GettingUp)

	hum.WalkSpeed = 16
	hum.JumpPower = 50

		hum.AutoRotate = true
	end
end

return ragdoll

Unragdolling teleports the player sometimes
Providing the video seems difficult as it keeps using the wrong video
refer to the video i commented

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Using the counterers upvector to the player, tried to I couldnt find anything
1 Like

If you can also help me fix the camera bug I would appreciate that

nvm I found a module that works well

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