Advertisement
C-H-4-0-S

Rainbow chat v2

Aug 31st, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. local TextService = game:GetService("TextService")
  2.  
  3. function rainbowifyText(text)
  4. local rainbowColors = {
  5. Color3.fromRGB(255, 0, 0),
  6. Color3.fromRGB(255, 127, 0),
  7. Color3.fromRGB(255, 255, 0),
  8. Color3.fromRGB(0, 255, 0),
  9. Color3.fromRGB(0, 0, 255),
  10. Color3.fromRGB(75, 0, 130),
  11. Color3.fromRGB(148, 0, 211)
  12. }
  13.  
  14. local rainbowText = ""
  15. local characters = string.split(text, "")
  16.  
  17. for i, char in ipairs(characters) do
  18. local rainbowColor = rainbowColors[(i % #rainbowColors) + 1]
  19. rainbowText = rainbowText .. "<font color=\"rgb(" .. rainbowColor.R .. ", " .. rainbowColor.G .. ", " .. rainbowColor.B .. ")\">" .. char .. "</font>"
  20. end
  21.  
  22. return rainbowText
  23. end
  24.  
  25. game.Players.PlayerAdded:Connect(function(player)
  26. player.Chatted:Connect(function(message)
  27. local rainbowMessage = rainbowifyText(message)
  28. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(rainbowMessage, "All")
  29. end)
  30. end)
  31.  
  32. --enables bubble chat also
  33.  
  34. textcolour = Color3.new(0,0,0)
  35.  
  36. game:GetService("Chat").BubbleChatEnabled = true
  37.  
  38. coroutine.wrap(function()
  39. while wait() do
  40. for i = 0,255,10 do
  41. textcolour = Color3.new(255/255,i/255,0/255)
  42. wait()
  43. end
  44. for i = 255,0,-10 do
  45. textcolour = Color3.new(i/255,255/255,0/255)
  46. wait()
  47. end
  48. for i = 0,255,10 do
  49. textcolour = Color3.new(0/255,255/255,i/255)
  50. wait()
  51. end
  52. for i = 255,0,-10 do
  53. textcolour = Color3.new(0/255,i/255,255/255)
  54. wait()
  55. end
  56. for i = 0,255,10 do
  57. textcolour = Color3.new(i/255,0/255,255/255)
  58. wait()
  59. end
  60. for i = 255,0,-10 do
  61. textcolour = Color3.new(255/255,0/255,i/255)
  62. wait()
  63. end
  64. end
  65. end)()
  66.  
  67. local settings = {
  68.  
  69. }
  70.  
  71. while wait() do
  72. pcall(function()
  73. game:GetService("Chat"):SetBubbleChatSettings({
  74. TextColor3 = textcolour,
  75. -- The amount of time, in seconds, to wait before a bubble fades out.
  76. BubbleDuration = 10,
  77. -- The amount of messages to be displayed, before old ones disappear
  78. -- immediately when a new message comes in.
  79. MaxBubbles = 20,
  80.  
  81. -- Styling for the bubbles. These settings will change various visual aspects.
  82. BackgroundColor3 = Color3.fromRGB(0, 0, 0),
  83. TextSize = 16,
  84. Font = Enum.Font.Ubuntu, --Enum.Font.GothamSemibold
  85. Transparency = .1,
  86. CornerRadius = UDim.new(0, 30),
  87. TailVisible = true,
  88. Padding = 8, -- in pixels
  89. MaxWidth = 500, --in pixels
  90.  
  91. -- Extra space between the head and the billboard (useful if you want to
  92. -- leave some space for other character billboard UIs)
  93. VerticalStudsOffset = 0,
  94.  
  95. -- Space in pixels between two bubbles
  96. BubblesSpacing = 3,
  97.  
  98. -- The distance (from the camera) that bubbles turn into a single bubble
  99. -- with ellipses (...) to indicate chatter.
  100. MinimizeDistance = 200,
  101. -- The max distance (from the camera) that bubbles are shown at
  102. MaxDistance = 400,
  103. })
  104. end)
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement