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

I made a ralldoll death but how do I make it fly when the player die?

Asked by 4 years ago

so I made this basic ralldoll engine that if you die you turn into a ralldoll but i wan the ralldoll to fling when the player dies heres the script

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        c.Humanoid.BreakJointsOnDeath = false
        c.Humanoid.Died:Connect(function()
            for _, v in pairs(c:GetDescendants()) do
                if v:IsA("Motor6D") then
                    local logic0, logic21 = Instance.new("Attachment"), Instance.new("Attachment")
                    logic0.CFrame = v.C0
                    logic21.CFrame = v.C1
                    logic0.Parent = v.Part0
                    logic21.Parent = v.Part1


                    local logic1 = Instance.new("BallSocketConstraint")

                    logic1.Attachment0 = a0
                    logic1.Attachment1 = a1
                    logic1.Parent = v.Parent

                    v:Destroy()
                end
            end
            c.HumanoidRootPart.CanCollide = false
        end)
    end)
end)
0
you did not make that yourself it's from a youtube video EXPOSED maxpax2009 340 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

I would use a VectorForce like this

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        c.Humanoid.BreakJointsOnDeath = false

        c.Humanoid.Died:Connect(function()
            for _, v in pairs(c:GetDescendants()) do
                if v:IsA("Motor6D") then
                    local logic0, logic21 = Instance.new("Attachment"), Instance.new("Attachment")
                    logic0.CFrame = v.C0
                    logic21.CFrame = v.C1
                    logic0.Parent = v.Part0
                    logic21.Parent = v.Part1


                    local logic1 = Instance.new("BallSocketConstraint")

                    logic1.Attachment0 = logic0
                    logic1.Attachment1 = logic21
                    logic1.Parent = v.Parent

                    v:Destroy()
                end
            end
            c.HumanoidRootPart.CanCollide = false

            local hrp = c.HumanoidRootPart
            local rootAttachment = hrp.RootAttachment

            local force = Instance.new("VectorForce", hrp)

            force.Attachment0 = rootAttachment          
            force.Force = Vector3.new(math.random(-100, 100), 0, 500)
        end)
    end)
end)
0
thank you it makes it a bit more realistic Eric_pokemon 133 — 4y
Ad

Answer this question