I am making a ragdoll modulescript so I can easily toggle a ragdoll on a character for explosions and stuns, I am using the same method for ragdolls that I used in another game although it was in a serverscript, but it doesn’t seem to work anymore, the characters limbs are still very static and it just looks like the player is in the platform stand state, anyone know why? Here is the function:
function Ragdoll.TempRagdoll(char, length)
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") and v.Name ~= "Neck" then
local humanoid = char.Humanoid
local plr = game.Players:GetPlayerFromCharacter(char)
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.LimitsEnabled = true
b.Radius = 10
b.UpperAngle = 7.5
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Parent
b.TwistLimitsEnabled = true
humanoid.PlatformStand = true
v.Enabled = false
game.ReplicatedStorage.Events.ChangeState:FireAllClients(plr, "Ragdoll")
wait(length)
game.ReplicatedStorage.Events.ChangeState:FireAllClients(plr, "GetUp")
humanoid.PlatformStand = false
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
v.Enabled = true
end
end
for _, v in pairs(char:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v:Destroy()
end
end
end
end
end
local Ragdoll = {}
function Ragdoll.TempRagdoll(char, length)
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") and v.Name ~= "Neck" then
local humanoid = char.Humanoid
local plr = game.Players:GetPlayerFromCharacter(char)
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.LimitsEnabled = true
b.Radius = 10
b.UpperAngle = 7.5
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Parent
b.TwistLimitsEnabled = true
humanoid.PlatformStand = true
v.Enabled = false
game.ReplicatedStorage.Events.ChangeState:FireAllClients(plr, "Ragdoll")
wait(length)
game.ReplicatedStorage.Events.ChangeState:FireAllClients(plr, "GetUp")
humanoid.PlatformStand = false
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
v.Enabled = true
end
end
for _, v in pairs(char:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v:Destroy()
end
end
end
end
end
return Ragdoll
local Ragdoll = {}
function Ragdoll.TempRagdoll(char, length)
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") and v.Name ~= "Neck" then
local humanoid = char.Humanoid
local plr = game.Players:GetPlayerFromCharacter(char)
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.LimitsEnabled = true
b.Radius = 10
b.UpperAngle = 7.5
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Parent
b.TwistLimitsEnabled = true
humanoid.PlatformStand = true
v.Enabled = false
game.ReplicatedStorage.Events.ChangeState:FireAllClients(plr, "Ragdoll")
wait(length)
game.ReplicatedStorage.Events.ChangeState:FireAllClients(plr, "GetUp")
humanoid.PlatformStand = false
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
v.Enabled = true
end
end
for _, v in pairs(char:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v:Destroy()
end
end
end
end
end
return Ragdoll
Have you debugged by adding a print inside the function to check if it is being correctly executed from within the script(s) which is/are requiring it?
My game is R6, and I am not looking for a keybind ragdoll kit. I am making a configurable ragdoll module that can be temporarily activated for a short period of time (like for example when hit by a grenade blast)