I am currently trying to make a system that makes the player ragdoll when hit. However it isn’t working too well for me.
https://gyazo.com/1d7e6daf511b20f741e5e6edabd64df3
when the player is hit it applies body velocity and body angular velocity and it works perfectly without ragdoll, but when I added ragdoll to it the knock-back is around 10x more so i had to put the forces down a lot. when the ragdoll ends it just teleport’s the player into the void for some unknown reason.
Server script:
local PhysicsService = game:GetService("PhysicsService")
local module = require(script.ModuleScript)
local ragParts = script.RagdollParts:GetChildren()
local r6Client = script.R6RagdollClient
PhysicsService:CreateCollisionGroup("Ragdoll")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
char:WaitForChild("IsRagdolled").Changed:Connect(function(bool)
if bool then
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
v.Enabled = false;
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.Parent
end
end
else
--module:Unragdoll(player.Character)
for _, v in pairs(char:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
v:Destroy()
end
if v:IsA("Attachment") then
v:Destroy()
end
if v:IsA("Motor6D") then
v.Enabled = true;
end
end
end
end)
r6Client:Clone().Parent = char
end)
end)
local script:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local ragollTrigger = char:WaitForChild("RagdollTrigger")
local hrp = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
char:WaitForChild("IsRagdolled").Changed:Connect(function(bool)
if bool then
char:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
char:WaitForChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Ragdoll)
else
char:WaitForChild("Humanoid"):ChangeState(Enum.HumanoidStateType.GettingUp, true)
end
end)
this is my first time ever posting so I am sorry if i’m doing something wrong.
Any help is appreciated thanks!