matekaOSF2

messageEngine

Aug 31st, 2020 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. local newMessage = {}
  2.  
  3. function typeWrite(delay, message)
  4. local A_1 = "Dialogue"
  5. local A_2 =
  6. {
  7. [1] =
  8. {
  9. ["Delay"] = delay,
  10. ["Text"] = message,
  11. }
  12. }
  13. local Event = game:GetService("ReplicatedStorage").Event
  14. Event:FireServer(A_1, A_2)
  15. end
  16.  
  17. function newMessage:CreateMessage()
  18. local Message = Instance.new("ScreenGui")
  19. local DialogueHUD = Instance.new("Frame")
  20. local UIListLayout = Instance.new("UIListLayout")
  21.  
  22. Message.Name = "Message"
  23. Message.Parent = game.CoreGui
  24. Message.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  25.  
  26. DialogueHUD.Name = "DialogueHUD"
  27. DialogueHUD.Parent = Message
  28. DialogueHUD.BackgroundColor3 = Color3.new(1, 1, 1)
  29. DialogueHUD.BackgroundTransparency = 1
  30. DialogueHUD.Position = UDim2.new(0, 0, 1, 0)
  31. DialogueHUD.Size = UDim2.new(1, 0, 0, -200)
  32.  
  33. UIListLayout.Parent = DialogueHUD
  34. UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  35. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  36.  
  37. local epicLibrary = {}
  38.  
  39. function epicLibrary:NewText(Text, Delay, Color, t2)
  40. local ch = false
  41. if Color ~= nil then
  42. local TextLabel = Instance.new("TextLabel")
  43.  
  44. TextLabel.Parent = DialogueHUD
  45. TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  46. TextLabel.BackgroundTransparency = 1
  47. TextLabel.BorderSizePixel = 0
  48. TextLabel.Position = UDim2.new(0, 0, 1, 0)
  49. TextLabel.Size = UDim2.new(1, 0, -0, 42)
  50. TextLabel.Font = Enum.Font.GothamBold
  51. TextLabel.TextColor3 = Color
  52. TextLabel.TextScaled = false
  53. TextLabel.TextSize = 24
  54. TextLabel.Text = Text
  55. TextLabel.TextWrapped = true
  56. typeWrite(Delay, t2)
  57. ch = true
  58.  
  59. while wait() do
  60. if ch then
  61. if game.Players.LocalPlayer.PlayerGui.MessageGUI.DialogueHUD.BG.ImageTransparency == 1 then
  62. for i,v in pairs(DialogueHUD:GetChildren()) do
  63. if string.find(v.Name, "TextLabel") then
  64. v:Destroy()
  65. end
  66. end
  67. ch = false
  68. end
  69. end
  70. end
  71. end
  72. end
  73.  
  74. return epicLibrary
  75. end
  76.  
  77. return newMessage
Add Comment
Please, Sign In to add comment