Hey all, I’ve been doing my own ragdoll script for my game, and I have this issue: (See the video)
https://gyazo.com/282798f1b2e50afa01e27adee50ae695
My current script in Server Script Service:
local Debris = game:GetService("Debris")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid").BreakJointsOnDeath = false
char.Humanoid.Died:Connect(function()
char.Archivable = true
local corpse = char:Clone()
corpse.Name = char.Name.." corpse"
if corpse:FindFirstChild("Humanoid") then
local hum = corpse:FindFirstChild("Humanoid")
hum:ChangeState(Enum.HumanoidStateType.Ragdoll)
hum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
hum.MaxHealth = 0
hum.Health = 0
hum.PlatformStand = false
end
corpse.HumanoidRootPart:Destroy()
for _, v in pairs(corpse:GetDescendants{}) do
if v:isA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v:Destroy()
end
local part = corpse.Head
local bf = Instance.new("BodyForce")
--bf.Force = Vector3.new(0,0,-10)
local a = math.random(-4,4)
if a >= -4 and a <= 0 then
bf.Force = Vector3.new(math.random(-10,15), 0, -10)
elseif a >= 0 and a <=4 then
bf.Force = Vector3.new(math.random(-15,10), 0, 10)
end
bf.Parent = part
end
corpse.Parent = workspace
char.Parent = nil
Debris:AddItem(corpse, 60)
end)
end)
end)
Any help would be appreciated, I spent a lot of time trying to figure out how to fix it, and still haven’t.
EDIT: I also tried to change humanoid state to Ragdoll, but it didn’t change a lot.