Advertisement
einsteinK

Roblox - GetChatColor

Aug 6th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. -- Cuz loleris is like the 10th person asking for it
  2.  
  3. local colors = {
  4.     Color3.new(253/255, 41/255, 67/255),
  5.     Color3.new(1/255, 162/255, 255/255),
  6.     Color3.new(2/255, 184/255, 87/255),
  7.     BrickColor.new("Bright violet").Color,
  8.     BrickColor.new("Bright orange").Color,
  9.     BrickColor.new("Bright yellow").Color,
  10.     BrickColor.new("Light reddish violet").Color,
  11.     BrickColor.new("Brick yellow").Color,
  12. }
  13.  
  14. local function GetChatColor(pName) local value = 0
  15.     for i=1,#pName do
  16.         local cValue = pName:sub(i,i):byte()
  17.         local reverseIndex = #pName - i + 1
  18.         reverseIndex = reverseIndex - #pName%2
  19.         if reverseIndex%4 >= 2 then
  20.             cValue = -cValue
  21.         end value = value + cValue
  22.     end return colors[value%#colors)+1]
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement