local player = game.Players.LocalPlayer local runService = game:GetService("RunService") local kbPower = 1000 local upForce = 250 local stunTime = 0.9 local cd = 0.5 local lastKb = 0 local ragdolled = false local function ragdoll(char, enable) if not char then return end local hum = char:FindFirstChildOfClass("Humanoid") if not hum then return end local r6 = hum.RigType == Enum.HumanoidRigType.R6 hum.PlatformStand = enable hum.AutoRotate = not enable hum.Sit = false if enable then for _, joint in char:GetDescendants() do if joint:IsA("Motor6D") then if r6 and joint.Name == "Neck" then continue end if joint.Enabled then joint.Enabled = false local a0 = Instance.new("Attachment") a0.Name = "TempAttachment0" a0.Parent = joint.Part0 a0.CFrame = joint.C0 local a1 = Instance.new("Attachment") a1.Name = "TempAttachment1" a1.Parent = joint.Part1 a1.CFrame = joint.C1 local bs = Instance.new("BallSocketConstraint") bs.Name = "TempBallSocket" bs.Attachment0 = a0 bs.Attachment1 = a1 bs.Parent = joint.Parent end end end ragdolled = true else for _, joint in char:GetDescendants() do if joint:IsA("Motor6D") then joint.Enabled = true end end for _, item in char:GetDescendants() do if item.Name:find("Temp") then item:Destroy() end end hum.PlatformStand = false hum.AutoRotate = true ragdolled = false end end local function waitLand(hrp) local landed = false local start = tick() while not landed and tick() - start < 10 do runService.Heartbeat:Wait() local ray = Ray.new(hrp.Position + Vector3.new(0, 0.5, 0), Vector3.new(0, -4, 0)) local hit, pos = workspace:FindPartOnRayWithIgnoreList(ray, {hrp.Parent}) if hit and (pos - hrp.Position).Magnitude < 5 then landed = true end end return landed end local function applyKb() local char = player.Character if not char then return end local hrp = char:FindFirstChild("HumanoidRootPart") local hum = char:FindFirstChildOfClass("Humanoid") if not hrp or not hum then return end if tick() - lastKb < cd then return end lastKb = tick() hum:ChangeState(Enum.HumanoidStateType.Physics) local look = hrp.CFrame.LookVector local back = -look * kbPower local force = back + Vector3.new(0, upForce, 0) ragdoll(char, true) hrp.AssemblyLinearVelocity = Vector3.new(0, 0, 0) hrp.AssemblyAngularVelocity = Vector3.new(0, 0, 0) hrp:ApplyImpulse(force * hrp.AssemblyMass * 0.5) task.wait(0.05) hrp:ApplyImpulse(force * hrp.AssemblyMass) task.spawn(function() if waitLand(hrp) then task.wait(stunTime) ragdoll(char, false) task.wait(0.1) if hum and hum.Health > 0 then hum:ChangeState(Enum.HumanoidStateType.GettingUp) end else task.wait(stunTime) ragdoll(char, false) end end) end local function setupDamage() local char = player.Character if not char then player.CharacterAdded:Wait() char = player.Character task.wait(1) end local hum = char:WaitForChild("Humanoid") local lastHp = hum.Health local con con = hum:GetPropertyChangedSignal("Health"):Connect(function() if not char or not char.Parent then con:Disconnect() task.wait(2) setupDamage() return end local curHp = hum.Health if curHp < lastHp and curHp > 0 then applyKb() end lastHp = curHp if hum.Health <= 0 then con:Disconnect() task.spawn(function() player.CharacterAdded:Wait() task.wait(2) setupDamage() end) return end end) return con end task.spawn(function() setupDamage() end) player.CharacterAdded:Connect(function(char) task.wait(2) setupDamage() end)