Hello, so I’m currently having some issues with a ragdoll script. Everything works perfectly fine but the only thing that bugs me is that when the character ragdolls I have this really weird camera shake bug?
Any helps would be helpful, thanks
Hello, so I’m currently having some issues with a ragdoll script. Everything works perfectly fine but the only thing that bugs me is that when the character ragdolls I have this really weird camera shake bug?
Any helps would be helpful, thanks
hum?
Can you send me the script?
Yeah sure:
This is the server side script for the actual ragdoll:
changeHumanoidTypeEvent:FireClient(playerToRagdoll,"pyhsics")
playerToRagdoll:SetAttribute("Ragdolled",true)
for index,motor in pairs(character:GetDescendants()) do
if (motor:IsA("Motor6D")) then
if (not motor.Enabled) then
changeHumanoidTypeEvent:FireClient(playerToRagdoll,"gettingUp")
playerToRagdoll:SetAttribute("Ragdolled",false)
return
end
end
end
for index,motor in pairs(character:GetDescendants()) do
if (motor:IsA("Motor6D")) then
if (motor.Name ~= "Root" and motor.Name ~= "RootJoint") then
local attachment0 = Instance.new("Attachment")
attachment0.Name = "RagdollSocket"
attachment0.CFrame = motor.C0
attachment0.Parent = motor.Part0
local attachment1 = Instance.new("Attachment")
attachment1.Name = "RagdollSocket"
attachment1.CFrame = motor.C1
attachment1.Parent = motor.Part1
local socket = ragdollJoints:FindFirstChild(motor.Name):Clone()
socket.Attachment0 = attachment0
socket.Attachment1 = attachment1
socket.Enabled = true
socket.Parent = motor
motor.Enabled = false
end
end
end
character.HumanoidRootPart.CanCollide = false
character.HumanoidRootPart.Massless = true
And this is the remote event handler (Client) to change the humanoid state type:
changeHumanoidTypeEvent.OnClientEvent:Connect(function(state)
if (state == "pyhsics") then
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
elseif (state == "gettingUp") then
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)
changeHumanoidTypeEvent:FireClient(playerToRagdoll,"pyhsics")
playerToRagdoll:SetAttribute("Ragdolled",true)
for index,motor in pairs(character:GetDescendants()) do
if (motor:IsA("Motor6D")) then
if (not motor.Enabled) then
changeHumanoidTypeEvent:FireClient(playerToRagdoll,"gettingUp")
playerToRagdoll:SetAttribute("Ragdolled",false)
return
end
end
end
for index,motor in pairs(character:GetDescendants()) do
if (motor:IsA("Motor6D")) then
if (motor.Part0 ~= playerToRagdoll.PrimaryPart and motor.Part1 ~= playerToRagdoll.PrimaryPart) then
local attachment0 = Instance.new("Attachment")
attachment0.Name = "RagdollSocket"
attachment0.CFrame = motor.C0
attachment0.Parent = motor.Part0
local attachment1 = Instance.new("Attachment")
attachment1.Name = "RagdollSocket"
attachment1.CFrame = motor.C1
attachment1.Parent = motor.Part1
local socket = ragdollJoints:FindFirstChild(motor.Name):Clone()
socket.Attachment0 = attachment0
socket.Attachment1 = attachment1
socket.Enabled = true
socket.Parent = motor
motor.Enabled = false
end
end
end
character.HumanoidRootPart.CanCollide = false
character.HumanoidRootPart.Massless = true
Could you please explain what this changes?
Edit: Didn’t work sadly
change your camera’s subject from humanoid to torso or uppertorso when ragdolling then switch it back when your done