Advertisement
Guest User

submission for arxk

a guest
Mar 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. local chatQue = {}
  2.  
  3. local function shuffleUpOld()
  4. for i, c in pairs(script.Parent:GetChildren()) do
  5. if c and c.ClassName == "TextLabel" then
  6. if tonumber(c.Name) then
  7. c.Name = tonumber(c.Name) + 1
  8. c:TweenPosition(UDim2.new(0, 0, 0.075 - ((tonumber(c.Name) - 1) * 0.04), 0), "Out", "Linear", 0.1, true)
  9. end
  10. end
  11. end
  12. end
  13.  
  14. local function colorMessage(color, message)
  15. message.TextColor3 = Color3.fromRGB(color)
  16. end
  17.  
  18. local function printNotification(message)
  19. print(message)
  20. end
  21.  
  22. local function destroyNotifcation()
  23. for i,v in pairs(script.Parent:GetChildren()) do
  24. if v:IsA("TextLabel") and v.Name == "Notification" then
  25. v:Destroy()
  26. end
  27. end
  28. end
  29.  
  30. local function doNotification(message, color)
  31. local newNotification = script.Notification:Clone()
  32. newNotification.Text = message
  33. newNotification.TextColor3 = color
  34. newNotification.Name = 1
  35. newNotification.Parent = script.Parent
  36. newNotification:TweenPosition(UDim2.new(0.299, 0,0.169, 0), "Out", "Linear", 0.1, true)
  37. wait(0.1)
  38. spawn(function()
  39. wait(5)
  40. newNotification:TweenPosition(UDim2.new(0.299, 0,-2, 0), "Out", "Linear", 0.1, true)
  41. wait(0.1)
  42. newNotification:Destroy()
  43. end)
  44. end
  45.  
  46. game.ReplicatedStorage.Events.SendNotification.OnClientEvent:connect(function(message, color)
  47. if message and color then
  48. local uniqueID = string.sub(message, 1, string.len(message)/2) .. (tick() - math.random())
  49. table.insert(chatQue, #chatQue + 1, uniqueID)
  50. repeat wait() until chatQue[1] == uniqueID
  51.  
  52. shuffleUpOld()
  53. doNotification(message, color)
  54.  
  55. table.remove(chatQue, 1)
  56. end
  57. end)
  58.  
  59. _G.notifyPlayer = function(message, color)
  60. spawn(function()
  61. if message and color then
  62. local uniqueID = string.sub(message, 1, string.len(message)/2) .. (tick() - math.random())
  63. table.insert(chatQue, #chatQue + 1, uniqueID)
  64. repeat wait() until chatQue[1] == uniqueID
  65.  
  66. shuffleUpOld()
  67. doNotification(message, color)
  68.  
  69. table.remove(chatQue, 1)
  70. end
  71. end)
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement