I don’t even know what’s wrong with this ragdoll. It’s smooth on the person ragdolling but if you look on the server the torso moves and the limbs freeze for a second then attach back to the ragdoll. It happens when I toggle the Motor6D’s Part1 and Enabled. It literally doesn’t make sense.
I tried settings the NetworkOwner to the server and massless on everything. Nothing seems to work
Is this like a Motor6D issue?
The ragdoll works, but other players and the server, THE SERVER ITS SELF SEES THE LIMBS FREEZE FOR A BIT
local Ragdoll = {}
local RagdollFunctions = {}
function Ragdoll.new(character: Model)
local self = setmetatable({}, {__index = RagdollFunctions})
self.BodyParts = { "Torso" }
self.Character = character
self.Humanoid = character:FindFirstChildOfClass("Humanoid")
self.Ragdolled = false
self.RagdollParts = {}
self.RagdollWelds = {}
return self
end
function RagdollFunctions:Toggle(boolean: boolean)
if self.Ragdolled == boolean then return end
if boolean and not self.Ragdolled then
self:Toggle(false)
self.Ragdolled = true
local rootPartWeld = Instance.new("Weld")
rootPartWeld.Name = "RagdollRootPart"
rootPartWeld.Part0 = self.Character.Torso
rootPartWeld.Part1 = self.Humanoid.RootPart
rootPartWeld.Parent = self.Humanoid.RootPart
table.insert(self.RagdollWelds, rootPartWeld)
self.Humanoid.RootPart.RootJoint.Enabled = false
self.Humanoid.PlatformStand = true
for _, bodyPartName in next, self.BodyParts do
local bodyPart = self.Character[bodyPartName] :: Motor6D
for _, motor6D: Motor6D in next, bodyPart:GetChildren() do
if motor6D:IsA("Motor6D") then
if not motor6D.Part0 or not motor6D.Part1 then continue end
local motorPart1 = motor6D.Part1
self.RagdollParts[motorPart1.Name] = {}
local ballSocketConstraint = Instance.new("BallSocketConstraint")
local ragdollAttachment = Instance.new("Attachment")
ragdollAttachment.Name = "RagdollAttachment"
ragdollAttachment.CFrame = motor6D.C0
ragdollAttachment.Parent = motor6D.Part0
local limbRagdollAttachment = Instance.new("Attachment")
limbRagdollAttachment.Name = "LimbRagdollAttachment"
limbRagdollAttachment.CFrame = motor6D.C1
limbRagdollAttachment.Parent = motorPart1
ballSocketConstraint.Enabled = true
ballSocketConstraint.Attachment0 = ragdollAttachment
ballSocketConstraint.Attachment1 = limbRagdollAttachment
ballSocketConstraint.LimitsEnabled = true
ballSocketConstraint.TwistLimitsEnabled = true
local ragdollPart = Instance.new("Part")
ragdollPart.Name = "RagdollPart"
ragdollPart.Transparency = 1
ragdollPart.Size = motorPart1.Size/1.5
ragdollPart.CollisionGroup = "Ragdoll"
ragdollPart.CFrame = motorPart1.CFrame
ragdollPart.CanCollide = true
ragdollPart.Parent = motorPart1
local ragdollWeld = Instance.new("Weld")
ragdollWeld.Name = "RagdollWeld"
ragdollWeld.Part0 = motorPart1
ragdollWeld.Part1 = ragdollPart
ragdollWeld.Parent = ragdollPart
ballSocketConstraint.Parent = motorPart1
motor6D.Part1 = nil
self.RagdollParts[motorPart1.Name].Part1 = motorPart1
self.RagdollParts[motorPart1.Name].Motor = motor6D
self.RagdollParts[motorPart1.Name][ballSocketConstraint.Name] = ballSocketConstraint
self.RagdollParts[motorPart1.Name][ragdollAttachment.Name] = ragdollAttachment
self.RagdollParts[motorPart1.Name][limbRagdollAttachment.Name] = limbRagdollAttachment
self.RagdollParts[motorPart1.Name][ragdollPart.Name] = ragdollPart
self.RagdollParts[motorPart1.Name][ragdollWeld.Name] = ragdollWeld
end
end
end
elseif self.Ragdolled then
self.Ragdolled = false
self.Humanoid.PlatformStand = false
self.Humanoid.RootPart.Massless = false
self.Humanoid.RootPart.RootJoint.Enabled = true
for i, essentials in next, self.RagdollParts do
essentials.Motor.Part1 = essentials.Part1
essentials.RagdollAttachment:Destroy()
essentials.LimbRagdollAttachment:Destroy()
essentials.BallSocketConstraint:Destroy()
essentials.RagdollPart:Destroy()
end; for _, v in next, self.RagdollWelds do v:Destroy() end
table.clear(self.RagdollWelds)
table.clear(self.RagdollParts)
end
end
return Ragdoll