Hello! So I am currently making a ragdoll system for an RPG game I’m working on, and it works for the most part but… every time the player gets ragdolled, they start glitching around a LOT while they are ragdolled. They don’t end up actually getting flung but this is causing some lag and is visually unappealing.
Additionally, this is being called from a server script
Here is my current ragdoll function:
function module.Ragdoll(Character)
local CT = CombatTable[Character.Name]
if not CT.Ragdolled then
CT.Ragdolled = true
CT.WallRunning = false
CT.Running = false
CT.MaxMomentum = 10
CT.Acceleration = 1
if game.Players:GetPlayerFromCharacter(Character) then
Character.HumanoidRootPart.Movement.VectorVelocity = Vector3.new(0,0,0)
Character.HumanoidRootPart.Movement.Enabled = false
end
for i, part in ipairs(Character:GetDescendants()) do
if part:IsA("Motor6D") then
local Socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = part.Part0
a2.Parent = part.Part1
Socket.Parent = part.Parent
Socket.Attachment0 = a1
Socket.Attachment1 = a2
a1.CFrame = part.C0
a2.CFrame = part.C1
Socket.LimitsEnabled = true
Socket.TwistLimitsEnabled = true
part.Enabled = false
elseif part:IsA("BasePart") and not CS:HasTag(part, "Tool") and part.Name ~= "Handle" then
CreateCollisionPart(part)
end
end
Character.Humanoid.RequiresNeck = true
Character.Humanoid.HipHeight = 0
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpHeight = 0
Character.Humanoid.PlatformStand = true
Character.Humanoid.AutoRotate = false
end
end
And here is the CreateCollisionPart function:
function CreateCollisionPart(Original)
local player = Players:GetPlayerFromCharacter(Original.Parent)
local part = Instance.new("Part")
part.Name = "FakePart"
part.CanCollide = true
part.Size = Original.Size
part.Transparency = 1
part.Massless = true
part.Parent = Original
part:SetNetworkOwner(player or nil)
local weld = Instance.new("Weld")
weld.Part0 = part
weld.Part1 = Original
weld.Parent = part
end
I’m pretty sure it’s a collision issue but I don’t know what to do to fix it.
Any suggestions?