You are doing:
if(isObject(%target = findClientbyname(%target)))
{
FindClientByName(%target).clanPrefix = trim(%chat SPC %chat2 SPC %chat3 SPC %chat4 SPC %chat5 SPC %chat6);
On the first line, you are assigning
%target to the result of
findClientByName(%target) , which is the ID of the client.
On the next line, you are searching for a client called [the id of the client] and attempting to set their clan prefix.
Also, you should standardize your capitalization. It technically doesn't matter in TorqueScript, but in most programming languages it does matter. Plus it makes it easier to read when you keep to one standard. The most common (at least in the community) is
CamelCase. Capitalize the first letter of each word, but not the very first letter, eg "findClientByName".