Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to ragdoll a humanoid on touch?

Asked by 3 years ago

I have a punching script and it is supposed to deal damage and ragdoll at the same time when it touches a humanoid. The issue is the script does not ragdoll as it should, it only deals damage.

local touchconn
    local Humanoid = character.Humanoid
    touchconn = newslash.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            if hit.Parent.Name ~= player.Name then
                hit.Parent.Humanoid:TakeDamage(0.7)
                Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll) --
                wait(0.1)
                if touchconn ~= nil then touchconn:Disconnect() end
                newslash:Destroy()
            end
        end
    end)
    wait(4)
    if touchconn ~= nil then touchconn:Disconnect() end
    newslash:Destroy()
end)

Answer this question