{URGENT HELP} How would I make a ragdoll tool?

Hey! My name is [redacted] I am an intermediate scripter and I needed to create a simple ragdoll Tool, and anything I seem to do does not work, Please Help!

Script so far:

local debounce = false

script.Parent.Touched:Connect(function(hit)
local HumanoidRootPart = hit.Parent:FindFirstChild(“HumanoidRootPart”)
if HumanoidRootPart and debounce == false then
debounce = true
print(hit.Name)
local mag = (HumanoidRootPart.Position - script.Parent.Position).Magnitude
if mag <= 10 then --player is within 10 studs of the object, change to however close you want them to stay to the part. If you want them to touch the part the entire time, then it will require a little guess and check to get the number right.
print(“initial contact reached”)
wait(5)–change this to however many seconds you want the player to touch the part
local mag2 = (HumanoidRootPart.Position - script.Parent.Position).Magnitude
if mag2 <= 10 then
–code to input ragdoll effect
wait(3)
debounce = true
end
end
end
end)

Please send scripts through/Advice Down below!

This tool, when you click it you ragdoll, right?

Yeah I think that’s what it does or it might be like a push tool to push others and make them Ragdoll idk I didn’t make this.

I found this script a while back, it doesn’t ragdoll the player, but it makes the other player sit

function onTouch(part)

local humanoid = part.Parent:FindFirstChild(“Humanoid”)

if (humanoid ~= nil) then

humanoid.Sit = true

end

end

script.Parent.Touched:connect(onTouch)

it’s old so probably doesn’t work

No its when someone gets touched by the tool also I am not looking for sit tools, bud.