Advertisement
C-H-4-0-S

Also a rainbow chat

Mar 31st, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement