You are using getRootElement() instead of the pointer to the player. Are you calling this function from a client call or are you using the onPlayerLogin event? In the first case you should use "client" (source isn't safe enough) and in the second case you should use "source". So these are the two possibilities:
triggerClientEvent(client, "onBan", getRootElement(), banauthor, banreason, bantime)
or
triggerClientEvent(source, "onBan", getRootElement(), banauthor, banreason, bantime)