Spectate a ragdoll on death ?

Tittle says it all . I am trying to figure out how to spectate a ragdoll that the player spawns when the player dies .

I tried

[lua]
local rag = ents.Create(“prop_ragdoll”)
rag:SetPos(ply:GetPos())
rag:SetAngles(ply:GetAngles())
rag:SetModel(ply:GetModel())
rag:Spawn()
rag:Activate()
rag:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
rag:SetRenderMode(RENDERMODE_GLOW )

	ply:SpectateEntity( rag  )
	ply:Spectate( OBS_MODE_CHASE  )

[/lua]

It did not work . any help??

Look at ulx’s !ragdoll?

bump?

any help please?

bump?

Your really going to have to post some Lua errors or more debug info for us to help you.
Also are you sure it’s not just spawning the ragdoll in some unexpected place?
Also confirm that the code is infact being run properly in the first place.

So just a quick checklist:
Is your code being run at all? Add print statements to confirm.
Where is the ragdoll being spawned? is it possible it’s glitching under the ground or something?
What can you simplify? Remove any code that you don’t really need there… you seem to have stuff involving setting it’s collision group and render mode… remove that for now and add it back once you get the basics working.

That’s about it…