How to turn player in ragdoll?

Hi everyone, im newbie in LUA coding and i have a question.

How to turn player in ragdoll and visa verse?

I want to do something like

if you press on the g button
then you turn in ragdoll

I dont know how to do this, but i need it for one gamemode