local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local root = char:WaitForChild("HumanoidRootPart") -- UI Setup local screen = Instance.new("ScreenGui", plr:WaitForChild("PlayerGui")) screen.ResetOnSpawn = false local btn = Instance.new("TextButton", screen) btn.Size = UDim2.new(0, 140, 0, 50) btn.Position = UDim2.new(0.5, -70, 0.85, 0) btn.Text = "Toggle Ragdoll" btn.TextSize = 20 btn.Font = Enum.Font.SourceSansBold btn.BackgroundColor3 = Color3.fromRGB(20, 20, 20) btn.TextColor3 = Color3.fromRGB(255, 255, 255) btn.BorderSizePixel = 0 btn.Active = true btn.AutoButtonColor = true -- Collect joints & parts local joints, parts = {}, {} for _,v in pairs(char:GetDescendants()) do if v:IsA("Motor6D") and v.Part0 and v.Part1 then table.insert(joints, v) end if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then table.insert(parts, v) end end local isRagdoll = false -- Ragdoll Logic local function setRagdoll(state) for _,p in pairs(parts) do p.CanCollide = not state end for _,j in pairs(joints) do if state then local a0, a1 = j.C0, j.C1 local p0, p1 = j.Part0, j.Part1 local att0 = Instance.new("Attachment", p0) local att1 = Instance.new("Attachment", p1) att0.CFrame = a0 att1.CFrame = a1 local bs = Instance.new("BallSocketConstraint") bs.Attachment0 = att0 bs.Attachment1 = att1 bs.Parent = p0 j.Enabled = false j.Name = "RagdollJoint_"..j.Name else for _,child in pairs(j.Part0:GetChildren()) do if child:IsA("BallSocketConstraint") then child:Destroy() end end for _,p in pairs({j.Part0, j.Part1}) do for _,a in pairs(p:GetChildren()) do if a:IsA("Attachment") then a:Destroy() end end end j.Enabled = true j.Name = j.Name:gsub("RagdollJoint_", "") end end end -- Button toggle btn.MouseButton1Click:Connect(function() isRagdoll = not isRagdoll setRagdoll(isRagdoll) if isRagdoll then hum:ChangeState(Enum.HumanoidStateType.Physics) else hum:ChangeState(Enum.HumanoidStateType.GettingUp) end end)