Advertisement
AstroScripts

Untitled

May 2nd, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. local ChatTable = {
  2. --- {'SpeakerName','Chat Message'};
  3. {'Person1','Just testing this UI currently.'};
  4. {'Person2','Oh, cool.'};
  5. {'Person1','I just decided to mess around with UI stuff, and I am too lazy to bother using Renpy.'};
  6. {'Person1','I will eventually get to using it.'};
  7. {'Person2','Oh, okay.'};
  8. {'Person1','See ya later.'};
  9. }
  10.  
  11. local ChatData = {
  12. --- ['SpeakerName'] = {BackgroundColor,BorderColor,ChatColor,Font}
  13. ['Person1'] = {Color3.fromRGB(56, 56, 56),Color3.fromRGB(0,0,0),Color3.fromRGB(255, 255, 255),Enum.Font.Code};
  14. ['Person2'] = {Color3.fromRGB(255, 170, 255),Color3.fromRGB(255, 85, 255),Color3.fromRGB(200, 20, 200),Enum.Font.Cartoon};
  15. }
  16.  
  17. -----------------------------------------------------
  18.  
  19. local uiService = game:GetService('UserInputService')
  20. local MainFrame = script.Parent:WaitForChild('MainFrame')
  21. local TextBar = MainFrame:WaitForChild('ChatTextGui')
  22. local Speaker = MainFrame:WaitForChild('SpeakerName')
  23. local CurrentChat = 1
  24. local IsChatFinished = false
  25.  
  26. local function ChatFunction()
  27. local Chat = ChatTable[CurrentChat]
  28. if IsChatFinished then
  29. IsChatFinished = false
  30. CurrentChat = CurrentChat + 1
  31. if CurrentChat > #ChatTable then return end
  32. ChatFunction()
  33. elseif not IsChatFinished then
  34. Speaker.Text = Chat[1]
  35. MainFrame.BackgroundColor3 = ChatData[Chat[1]][1]
  36. MainFrame.BorderColor3 = ChatData[Chat[1]][2]
  37. TextBar.Text = ''
  38. TextBar.TextColor3 = ChatData[Chat[1]][3]
  39. TextBar.Font = ChatData[Chat[1]][4]
  40. for i = string.len(Chat[2]),0,-1 do
  41. if IsChatFinished then
  42. TextBar.Text = Chat[2]
  43. IsChatFinished = true
  44. break
  45. end
  46. TextBar.Text = string.sub(Chat[2],1,string.len(Chat[2])-i)
  47. wait(.05)
  48. end
  49. IsChatFinished = true
  50. end
  51. end
  52.  
  53. wait(2)
  54.  
  55. spawn(uiService.InputBegan:Connect(function(Input)
  56. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  57. if not IsChatFinished then
  58. IsChatFinished = true
  59. return
  60. end
  61. ChatFunction()
  62. elseif Input.UserInputType == Enum.UserInputType.Touch then
  63. if not IsChatFinished then
  64. IsChatFinished = true
  65. return
  66. end
  67. ChatFunction()
  68. end
  69. end))
  70.  
  71. ChatFunction()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement