Player Death Body Model

Hey guysss… Not so long ago I asked for some support on ragdolls being black figures if someone dies if they have bough a custom model from the pointshop. They give me a new code to replace prop_ragdoll but it never worked. Maybe it didn’t work with the file. This is the part that turns players into ragdolls when they die.


function JB:PlayerDeath( p, a, d )
	if p:Team() == TEAM_PRISONER then
		p:SetTeam(TEAM_PRISONER_DEAD);
		local e = ents.Create("prop_ragdoll");
		e:SetModel(p:GetModel());
		e:SetPos(p:GetPos());
		e:GetAngles(p:GetAngles());
		e:SetVelocity(p:GetVelocity());
		e:Spawn();
		e:Activate();
		p:EmitSound(table.Random(DeathSounds),300,100);
		if p:Alive() then
			p:KillSilent()
			p:Spawn();
		end
	elseif p:Team() == TEAM_GUARD then -- or we simply check it.
		p:SetTeam(TEAM_GUARD_DEAD);
		local e = ents.Create("prop_ragdoll");
		e:SetModel(p:GetModel());
		e:SetPos(p:GetPos());
		e:GetAngles(p:GetAngles());
		e:SetVelocity(p:GetVelocity());
		e:Spawn();
		e:Activate();
		p:EmitSound(table.Random(DeathSounds),300,100);
		if p:Alive() then
			p:KillSilent()
			p:Spawn();
		end
	end
	hook.Add("PlayerDeath", "DropWeapon", function(ply)
            local wep = ply:GetActiveWeapon()
            if (wep:IsValid()) then
            ply:DropWeapon(wep)
        end
    end)
	if JB:RoundStatus() ~= ROUND_END then
		JB:CheckRoundEnd();
	end
end


…Anyone?