Do you happen to have any one of the Legacy Body Movers inside your character’s Torso or HumanoidRootPart before ragdolling? Your script seems fine, so it might be an external force acting on the character.
Have you tried enabling PlatformStand on the Humanoid before ragdolling?
Hmm… Maybe you should try not replacing ALL the Motor6d’s. Normally you wouldn’t want to mess with the one connecting the HumanoidRootPart to the Torso, for instance. Try creating an if statement that checks to make sure that it only replaces the joints that you need to be loose, and see if that helps.
Also make sure that the character’s HumanoidRootPart is not colliding with the other body parts, and causing weird physics.
This is from the rootpart colliding with the rest of the body, I don’t know too much of the specifics but if you use some NoCollisionConstraint | Documentation - Roblox Creator Hub on all the parts to the humanoidrootpart, you may be able to get rid of this effect. Simply making the root non cancollide doesn’t fix it due to how humanoids are setup.
I tried out your code here, it helped alleviate the weird floating thing I got from trying to use code from this post: https://devforum.roblox.com/t/ragdoll-on-death-isnt-working/1282308/22, but whenever you walk close to the corpse, the corpse stands up. Not sure what is the root cause of this, also code bellow:
--in server script detecting death
for _, v in pairs(character:GetDescendants()) do
if v:IsA("Motor6D") then
local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
Att0.CFrame = v.C0
Att1.CFrame = v.C1
Att0.Parent = v.Part0
Att1.Parent = v.Part1
local BSC = Instance.new("BallSocketConstraint")
BSC.Attachment0 = Att0
BSC.Attachment1 = Att1
BSC.Parent = v.Part0
v:Destroy()
end
end
character.HumanoidRootPart.CanCollide = false
local BodyClone = Instance.new("Model", game.Workspace)
BodyClone.Name=""
--local CloneHumanoid = Instance.new("Humanoid", BodyClone)
--CloneHumanoid.DisplayDistanceType=Enum.HumanoidDisplayDistanceType.None
character:FindFirstChild("Humanoid"):Clone().Parent=BodyClone
BodyClone.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
BodyClone.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
for _, v in pairs (character:GetChildren()) do
if v:IsA("Humanoid") then continue end
--if v:IsA("ShirtGraphic") then TShirtId = v.Graphic end
v.Parent=BodyClone
end
--not rly needed as I could do it within the for loop but it helped
--alleviate ragdoll issues such as them spasing out due to collision.
--I should also destroy every local script within.
coroutine.wrap(function()
player.CharacterAdded:Wait()
BodyClone.Health:Destroy()
BodyClone.Humanoid.Health=0
BodyClone.HumanoidRootPart.CanCollide=false
BodyClone.LowerTorso.CanCollide=false
BodyClone.RightUpperLeg.CanCollide=false
BodyClone.LeftUpperLeg.CanCollide=false
--if TShirtId~="" then
--BodyClone["Shirt Graphic"].Graphic=TShirtId
--end
end)()
Okay so for anyone reading, I found a different way, what I did was use this: EDIT: IT STILL FREAKING GLITCHES IM JUST GOING TO USE THE BASIC CODE WITHOUT A PERSISTENT MODEL…
I followed instructions except I put the module under the death checker in server script service.
and then I just do:
require(script.Ragdoll):Activate(BodyClone)
and then I wait till the character loads (look at my above code in above post) and then wait 1 second (this is to allow any natural physics to occur i.e. falling from an area, could make it longer) and then anchor all the body parts of the ragdoll (without doing this, the body will start twitching)
for i, v in pairs(BodyClone:GetChildren()) do
if v:IsA("MeshPart") then
v.Anchored=true
end
end
note after some point you’ll need to fetch all the names of the corpses and destroy them or use the despawn feature depending on your needs.
Since you walk close to it and you move all characters parts into another model, this is probably because of Network Ownership. Try setting all Part network owner to server on server-side using:
Part:SetNetworkOwner(nil)
If that doesn’t solve, can you record from another player’s perspective?