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

local rag = ents.Create(“prop_ragdoll”)
rag:SetRenderMode(RENDERMODE_GLOW )

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


It did not work . any help??

Look at ulx’s !ragdoll?


any help please?


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…