You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
a working ragdoll system -
What is the issue?
the player parts are set to a different collision group yet they still seem to not collide with the other collision group in the case being Default
-
What solutions have you tried so far?
I have tested different humanoidstates, collosion groups
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local PlayerController = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules").CharacterModules.PlayerController)
local PS = game:GetService("PhysicsService")
local tempG = PS:RegisterCollisionGroup("TempGroup")
local Handler = {}
function Handler.Ragdoll(Enemychar,enemyHum)
local IsRagdoll = Enemychar:GetAttribute("Ragdoll")
if IsRagdoll then return end
Enemychar:SetAttribute("Ragdoll", true)
PlayerController.State(enemyHum,5)
enemyHum.AutoRotate = false
enemyHum.PlatformStand = true
enemyHum:ChangeState(Enum.HumanoidStateType.Physics)
enemyHum:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
enemyHum:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
enemyHum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
enemyHum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
for i, joint in Enemychar:GetDescendants() do
if joint:IsA('Motor6D') then
local socket = Instance.new('BallSocketConstraint')
socket.Parent = joint.Parent
local attachment0 = Instance.new('Attachment')
attachment0.Parent = joint.Part0
local attachment1 = Instance.new('Attachment')
attachment1.Parent = joint.Part1
attachment0.CFrame = joint.C0
attachment1.CFrame = joint.C1
socket.Attachment0 = attachment0
socket.Attachment1 = attachment1
socket.TwistLimitsEnabled = true
socket.LimitsEnabled = true
joint.Enabled = false
end
if joint:IsA("BasePart") or joint:IsA("MeshPart") then
joint.CollisionGroup = "TempGroup"
end
end
PS:CollisionGroupSetCollidable("TempGroup","Default",true)
task.delay(5,function()
Enemychar:SetAttribute("Ragdoll", false)
for i, joint in pairs(Enemychar:GetDescendants()) do
if joint:IsA('Motor6D') then
joint.Enabled = true
elseif joint:IsA('BallSocketConstraint') then
joint.Enabled = false
end
if joint:IsA("BasePart") or joint:IsA("MeshPart") then
joint.CollisionGroup = "Default"
end
end
enemyHum:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
enemyHum:ChangeState(Enum.HumanoidStateType.Running)
enemyHum.PlatformStand = false
enemyHum.AutoRotate = true
end)
end
return Handler