RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Write a script for R15 that causes the player to ragdoll upon death."
-- server script local function ragdoll(character) local humanoid = character:FindFirstChild("Humanoid") if not humanoid then return end humanoid.Died:Connect(function() for _, joint in ipairs(character:GetDescendants()) do if joint:IsA("Motor6D") then local attachment0 = Instance.new("Attachment", joint.Parent) attachment0.Name = "RagdollAttachment0" attachment0.Position = joint.C0.Position local attachment1 = Instance.new("Attachment", joint.Part0) attachment1.Name = "RagdollAttachment1" attachment1.Position = joint.C1.Position local ballSocket = Instance.new("BallSocketConstraint") ballSocket.Attachment0 = attachment0 ballSocket.Attachment1 = attachment1 ballSocket.Parent = joint.Parent end end for _, part in ipairs(character:GetDescendants()) do if part:IsA("BasePart") then part.Anchored = false end end end) end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(ragdoll) end) for _, player in ipairs(game.Players:GetPlayers()) do if player.Character then ragdoll(player.Character) end end