Help with Player Death

Hello i have created a simple script wich respawns the Player when he gets killed with a specifig weapon

Code:

local classes = {
    ["weapon_lightsaber_training"] = true,
    ["weapon_fists"] = true,
    ["weapon_lightsaber_dual_training"] = true,
    ["weapon_frag"] = true,
    ["weapon_lightsaber_shock"] = true,
    ["heavy_shield"] = true,
    ["nng_train_e5"] = true,
}

hook.Add("DoPlayerDeath", "Unique_Name", function(victim, attacker, damageInfo)

    if not attacker:IsValid() then
        return
    end

    local weapon = attacker:GetActiveWeapon()

if weapon:IsValid() and classes[weapon:GetClass()] or weapon:IsAttached("trainammo") then
        timer.Simple(10, function()
            if victim:IsValid() then
               victim:revive()
               victim:SetHealth(victim:GetMaxHealth())
            end
        end)
     end
 end)

But when i kill a player with something like a lightsaber from Wos (Class = weapon_lightsaber_aayla) then it dose not spawn a Ragdoll from the Player so if you can help me pls help :slight_smile:

What does the ply:revive() function do?
Then lightsaber not spawning a ragdoll will be something from that addon doing that which means you would have to edit that addon.

I agree with @Brickwall, the addon is probably using a Hook to remove the ragdoll after death.
If you just have the addon installed you can probably delete the hook and hope it doesn’t break anything with that weapon.
Either that or you make another hook which checks if you’ve been killed by a lightsaber and THEN spawn a death ragdoll.

I’d find the specific functions and hooks needed, but the wiki has been griefed. I’ll be back when it’s fixed.

The ply:revive() function does that after 10 secounds the player gets Respawned(Revived) at the location where his Ragdoll is and after he respawned he gets the Weapons back that he has picked up

Ah okay, well then you would just need to look through the lightsaber code and remove the code that prevents it from spawning a ragdoll.