Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Whenever I load my character I don't ragdoll, why?

Asked by 3 years ago
Edited 3 years ago

I'm trying to make it so that the player can move while they are ragdolled, but the player doesn't even ragdoll at all. I got the ragdoll code from this video: https://www.youtube.com/watch?v=OxtXeV49V60. Did I place a line of code in the wrong place or what? Thanks to who solves this.

Code:

local char = script.Parent
local hum = char.Humanoid

hum.BreakJointsOnDeath = false

game.Players.PlayerAdded:Connect(function()
    for i, j in pairs(char:GetDescendants()) do
        if j:IsA('Motor6D') then
            local socket = Instance.new('BallSocketConstraint', j.Parent)
            local a0 = Instance.new('Attachment', j.Part0)
            local a1 = Instance.new('Attachment', j.Part1)

            socket.Attachment0 = a0
            socket.Attachment1 = a1
            a0.CFrame = j.C0
            a1.CFrame = j.C1
            socket.LimitsEnabled = true
            socket.TwistLimitsEnabled = true
            j:Destroy()
        end
    end
end)

Answer this question