Ragdoll script is not working

local tool = script.Parent -- Reference to the tool

tool.Activated:Connect(function()
	local h = script.Parent.HITBOX
	h.LaunchScript.Enabled = true 
	h.Script.Enabled = true 
	task.wait(3) -- Change this to the desired duration
	h.LaunchScript.Enabled = false
	h.Script.Enabled = false-- Enable the script when the tool is clicked
end)


script for enabling the other scripts within the hitbox.


local Debris = game:GetService("Debris")


local function onTouched(hit)

    local character = hit.Parent
    local humanoid = character:FindFirstChildWhichIsA("Humanoid")
    
    if humanoid then
  
        local bodyVelocity = Instance.new("BodyVelocity")
        
        local rootPart = character:FindFirstChild("HumanoidRootPart")
        if rootPart then
       
            local direction = rootPart.CFrame.lookVector
            
         
            bodyVelocity.Velocity = direction * 50 
            bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) 
            
            bodyVelocity.Parent = rootPart
            
    
            Debris:AddItem(bodyVelocity, 1)
        end
    end
end

local Hitbox = script.Parent

Hitbox.Touched:Connect(onTouched)

Flings player once they get hit, works.

script.Parent.Touched:Connect(function(part)
	if part.Parent:FindFirstChild("Humanoid") and part.Parent:FindFirstChild("IsRagdoll") then
		local player = game.Players:FindFirstChild(part.Parent.Name)
		local bool = part.Parent.IsRagdoll
		bool.Value = true
	task.wait(1.7)
		bool.Value = false
	end
end)

ragdolls the player.

Rrobvlx

I’m using a script that enables other scripts within the tool, but it bypasses the time I want it to wait till it turns off the script. Everything else works, it’s just the tool activation script that’s messing with me.
Please help

dont immediately enable it instead turn the activation script into a local script and then put a remote event and then modify some things around