Does anyone know how to fix ragdoll seizure so player just lies on ground and not become jittery???
function Effects.Ragdoll(char)
local RagScriptClone = script:FindFirstChild("Ragdoll"):Clone()
RagScriptClone.Parent = char
RagScriptClone.Disabled = false
game.ReplicatedStorage.RagdollEvent:FireAllClients(char.Name, "Ragdoll") -- fire an event to the client
char.Humanoid.JumpPower = 0 -- make sure they cant jump
for _, v in pairs(char:GetDescendants()) do -- looping through the character
if v:IsA("BasePart") and v.Name == "Head" or v.Name == "LowerTorso" then -- welding them so they can't move
local weld = Instance.new("Weld")
weld.Part0 = char.HumanoidRootPart
weld.Part1 = v
weld.C0 = char.HumanoidRootPart.CFrame:inverse()
weld.C1 = v.CFrame:inverse()
weld.Parent = char.HumanoidRootPart
weld.Name = "RagdollWeld"
end
if v:IsA("Motor6D") and char.Humanoid.RigType == Enum.HumanoidRigType.R15 then-- adding an attachment and constraint for each
local attachment1 = Instance.new("Attachment")
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment1.Name = "Attachment1"
attachment0.CFrame = v.C0
attachment1.CFrame = v.C1
attachment0.Parent = v.Part0
attachment1.Parent = v.Part1
local constraint = Instance.new("BallSocketConstraint") -- change to BallSocketConstraint if you want
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.Parent = v.Part0
v:Destroy()
local attachment1 = Instance.new("Attachment")
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment1.Name = "Attachment1"
attachment0.CFrame = v.C0
attachment1.CFrame = v.C1
attachment0.Parent = v.Part0
attachment1.Parent = v.Part1
local constraint = Instance.new("BallSocketConstraint") -- change to BallSocketConstraint if you want
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.Parent = v.Part0
v.Part0 = nil
end
end
end