Hiya devs, just question.
sometimes, not always and ic ant figure out the reasoning, the ragdoll with getup from its ragdolled state and start floating upwards?
function Ragdoller:Ragdoll(Character)
if Character:FindFirstChild("Ragdolled") then return end
if game.CollectionService:HasTag(Character, "IsRagdolled") then
return
end
game.CollectionService:AddTag(Character, "IsRagdolled")
spawn(function()
for _,v in pairs(Character:GetChildren()) do
if v.Name == "Blocking" then
v:Destroy()
end
end
givesound(Character)
end)
if not Character:FindFirstChild("Ragdolled") then
local ragdollfolder = Instance.new("Folder")
ragdollfolder.Name = "Ragdolled"
ragdollfolder.Parent = Character
end
print("Ragdolling")
Character.Humanoid.PlatformStand = true
Character.Humanoid.Sit = true
local Humanoid = Character.Humanoid
Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.AutoRotate = false
Character.Humanoid.JumpPower = 0
Character.Humanoid.PlatformStand = true
Character.Humanoid.Sit = true
local Humanoid = Character.Humanoid
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, true)
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)
Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.AutoRotate = false
Character.Humanoid.JumpPower = 0
local leftarm = Character:WaitForChild("Left Arm")
local rightrm = Character:WaitForChild("Right Arm")
local leftleg = Character:WaitForChild("Left Leg")
local rightleg = Character:WaitForChild("Right Leg")
if Character.Torso:FindFirstChild("Left Hip") then
Character.Torso:FindFirstChild("Left Hip").Enabled = false
Character.Torso.CanCollide = true
local head = Character.Head
local attach0 = Instance.new("Attachment",Character.Torso)
local attach1 = Instance.new("Attachment",Character["Left Leg"])
attach0.CFrame = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
attach1.CFrame = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
attach0.Name = "BallAttachment"
attach1.Name = "BallAttachment"
local glue = IntNew("BallSocketConstraint", Character.Torso)
glue.Attachment0 = attach0
glue.Attachment1 = attach1
glue.Name = "Left leg"
local collider = IntNew("Part", leftleg)
collider.Name = "Collider"
collider.Position = Vector3.new(0,999,0)
collider.Size = Vector3.new(1.5, 1, 1)
collider.Shape = "Block"
collider.Massless = true
local weld = IntNew("Weld", collider)
weld.Part0 = leftleg
weld.Part1 = collider
weld.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
collider.TopSurface = "Smooth"
collider.BottomSurface = "Smooth"
collider.formFactor = "Symmetric"
collider.Transparency = 1
------------
if Character.Torso:FindFirstChild("Right Hip") and Character.Torso:FindFirstChild("Right Shoulder") and Character.Torso:FindFirstChild("Left Hip") and Character.Torso:FindFirstChild("Left Shoulder") then
Character.Torso:FindFirstChild("Right Hip").Enabled = false
local attach0 = Instance.new("Attachment",Character.Torso)
local attach1 = Instance.new("Attachment",Character["Right Leg"])
attach0.Name = "BallAttachment"
attach1.Name = "BallAttachment"
attach0.CFrame = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
attach1.CFrame = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
local glue1 = IntNew("BallSocketConstraint", Character.Torso)
glue1.Attachment0 = attach0
glue1.Attachment1 = attach1
glue1.Name = "Right leg"
local collider1 = IntNew("Part", rightleg)
collider1.Name = "Collider"
collider1.Position = Vector3.new(0,9999,0)
collider1.Size = Vector3.new(1.5, 1, 1)
collider1.Massless = true
collider1.Shape = "Block"
local weld1 = IntNew("Weld", collider1)
weld1.Part0 = rightleg
weld1.Part1 = collider1
weld1.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
collider1.TopSurface = "Smooth"
collider1.BottomSurface = "Smooth"
collider1.formFactor = "Symmetric"
collider1.Transparency = 1
------------
Character.Torso:FindFirstChild("Right Shoulder").Enabled = false
local attach0 = Instance.new("Attachment",Character.Torso)
local attach1 = Instance.new("Attachment",Character["Right Arm"])
attach0.Name = "BallAttachment"
attach1.Name = "BallAttachment"
attach0.CFrame = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
attach1.CFrame = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
local glue11 = IntNew("BallSocketConstraint", Character.Torso)
glue11.Attachment0 = attach0
glue11.Attachment1 = attach1
glue11.Name = "Right shoulder"
local collider11 = IntNew("Part", rightrm)
collider11.Name = "Collider"
collider11.Position = Vector3.new(0,9999,0)
collider11.Size = Vector3.new(1.8,1,1)
collider11.Massless = true
collider11.Shape = "Block"
local weld11 = IntNew("Weld", collider11)
weld11.Part0 = rightrm
weld11.Part1 = collider11
weld11.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
collider11.TopSurface = "Smooth"
collider11.BottomSurface = "Smooth"
collider11.formFactor = "Symmetric"
collider11.Transparency = 1
------------
Character.Torso:FindFirstChild("Left Shoulder").Enabled = false
local attach0 = Instance.new("Attachment",Character.Torso)
local attach1 = Instance.new("Attachment",Character["Left Arm"])
attach0.Name = "BallAttachment"
attach1.Name = "BallAttachment"
attach0.CFrame = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
attach1.CFrame = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
local glue111 = IntNew("BallSocketConstraint", Character.Torso)
glue111.Attachment0 = attach0
glue111.Attachment1 = attach1
glue111.Name = "Left shoulder"
local collider111 = IntNew("Part", leftarm)
collider111.Name = "Collider"
collider111.Position = Vector3.new(0,9999,0)
collider111.Size = Vector3.new(1.5, 1, 1)
collider111.Massless = true
collider111.Shape = "Block"
local weld111 = IntNew("Weld", collider111)
weld111.Part0 = leftarm
weld111.Part1 = collider111
weld111.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
collider111.TopSurface = "Smooth"
collider111.BottomSurface = "Smooth"
collider111.formFactor = "Symmetric"
collider111.Transparency = 1
--[[for i,v in pairs(Character:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
if v.CanCollide == false then
v.CanCollide = true
spawn(function()
repeat wait() until Character.Ragdolled.Value == false
v.CanCollide = false
end)
end
end
end]]
end
end
end