TTT Killed By Script


I am trying to use this Lua code to tell players what role they are killed by:

I modified it from this code:

I get this lua error in the console:

Here are a few TTT things I give away:

TTT End Round Music; different tables for each role. Make sure you only add/remove music, don’t change anything else. Use it to learn from.

TTT Kill Notifer; This does what you want; it’ll notify the victim who they were killed by, their killers’ role, and colorizes everything. Use it to learn from.

To fix yours, change

local role_color = {
[ROLE_TRAITOR] = Color(255,0,0,255),
[ROLE_INNOCENT] = Color(0,255,0,255),
[ROLE_DETECTIVE] = Color(0,0,255,255)


It’s incredibly weird that your first argument ( role_color ) is being seen as a table. It appears correct. Try this, and try my full script.

local role_color = { };
role_color[ROLE_TRAITOR] = Color( 255, 0, 0, 255 );
role_color[ROLE_INNOCENT] = Color( 0, 255, 0, 255 );
role_color[ROLE_DETECTIVE] = Color( 0, 0, 255, 255 );

Thanks, but I found an add on that does the same thing and it works like a charm. Solved.