local playername1 = string.gsub(playername0, "[b]", "b")
local playername2 = string.gsub(playername1, "[O]", "o")
local playername3 = string.gsub(playername2, "[(SS)]", "ss")
local playername4 = string.gsub(playername3, "[s]", "s")
if (string.find(playername4,"boss")) then
That's just... wrong...
You should just simply check for the tag in the last line, that is:
if (string.find(playername,"%[tag%]")) then
% are used because [ and ] are "magical" characters.