Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

0

you did not make that yourself it's from a youtube video EXPOSED

1 answer

✓ Accepted answer

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)

1 comment

0

thank you it makes it a bit more realistic

This discussion is preserved as it was. New answers, comments, and votes are closed.