Trying to create a TTT weapon that changes the team of a ragdoll

Hi, I want to create a TTT Traitor weapon that changes the team of a body to say Traitor. I’ve copied the contents of the lua file for the DNA scanner, so I have less to do but I’ve gotten stuck.
I’ve been coding for a few years and I have a basic understanding of how Lua works, so looking through the file for the DNA scanner I mostly understand what it does, but I don’t know how to get and then change the team of a ragdoll. The DNA scanner already interacts with the ragdoll, so I’ve got all that, but I don’t know the names of any of the variables that I need to use.

So could someone tell me the variable that stores the team of a ragdoll? I have no idea where I could go to find that kind of information bar looking through the gamemode files, which I did try but wasn’t very helpful.

Thanks in advance.

Serverside variable for the role on the ragdoll is rag.was_role which is set to the players role on death. I believe you can change it to ROLE_DETECTIVE, ROLE_TRAITOR, and ROLE_TERROR (I think that’s for innocent)

Thanks! I’ll try this

[editline]27th September 2017[/editline]

It worked! Thank you :slight_smile: