Greentext

I’m not that great with clientside lua, and I quickly tried this.


function GreenText( ply, text, public )    if (string.sub(text, 1, 1) == ">") then
        return Color( 0,0,255 ) .. text;
    end
end
hook.Add( "PlayerSay", "GreenText", GreenText );

Didn’t work.


18:49:04 Lua Error: [ERROR] lua/autorun/server/greentext.lua:3: attempt to concatenate a table value 1. v - lua/autorun/server/greentext.lua:3 2. unknown - lua/includes/modules/hook.lua:82

Any assistance?

What are you trying to do? Make all chat text green?



function GreenText( ply, text, public ) 
    if(string.find(text,">")) then
        chat.AddText(Color(0,255,0),text)
        return true
    end
end
hook.Add( "OnPlayerChat", "GreenText", GreenText );