I am currently using this function to ragdoll:
--server
function module.Ragdoll(player)
ReplicatedStorage.Ragdoll:FireClient(player)
local Character = player.Character
local Motors = {Character.Torso["Left Hip"],
Character.Torso["Right Hip"],
Character.Torso["Left Shoulder"],
Character.Torso["Right Shoulder"],
Character.Torso["Neck"],
Character.PrimaryPart["Root Hip"]
}
for _, obj in pairs(Motors) do
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = obj.C0
a1.CFrame = obj.C1
a0.Parent = obj.Part0
a1.Parent = obj.Part1
local BallSocket = Instance.new("BallSocketConstraint")
BallSocket.LimitsEnabled = true
BallSocket.TwistLimitsEnabled = true
BallSocket.Attachment0 = a0
BallSocket.Attachment1 = a1
BallSocket.Parent = obj.Part0
obj.Enabled = false
end
end
--client
ReplicatedStorage.Ragdoll.OnClientEvent:Connect(function()
local Character = LocalPlayer.Character
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
end)
This is resulting in the following:
As you can see in the video, the character seems to kind of teleport? How can I fix this?