Advertisement
ERROR_CODE

Untitled

Nov 21st, 2024 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. local screenGui = Instance.new("ScreenGui")
  2. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  3.  
  4. local notifications = {}
  5.  
  6. local function createNotification(text)
  7. if #notifications == 3 then
  8. notifications[1]:Destroy()
  9. table.remove(notifications, 1)
  10. end
  11.  
  12. local textLabel = Instance.new("TextLabel")
  13. textLabel.Size = UDim2.new(0, 200, 0, 50)
  14. textLabel.Position = UDim2.new(1, 0, 0.5, -25 * #notifications + 50 * #notifications)
  15. textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  16. textLabel.TextColor3 = Color3.new(1, 1, 1)
  17. textLabel.Text = text
  18. textLabel.Parent = screenGui
  19.  
  20. table.insert(notifications, textLabel)
  21.  
  22. textLabel:TweenPosition(UDim2.new(0.5, -100, textLabel.Position.Y.Scale, textLabel.Position.Y.Offset), "Out","Linear", 0.2, true)
  23.  
  24. for i = 1, #notifications - 1 do
  25. local offset = 50 + 50 * (#notifications - i - 1)
  26. notifications[i]:TweenPosition(UDim2.new(0.5, -100, notifications[i].Position.Y.Scale, notifications[i].Position.Y.Offset - offset), "Out","Linear", 0.2, true)
  27. end
  28.  
  29. delay(3, function()
  30. textLabel:TweenPosition(UDim2.new(1, 0, textLabel.Position.Y.Scale, textLabel.Position.Y.Offset), "Out","Linear", 0.2, true, function()
  31. textLabel:Destroy()
  32. table.remove(notifications, table.find(notifications, textLabel))
  33. end)
  34. end)
  35. end
  36.  
  37. createNotification("1")
  38. wait(2)
  39. createNotification("2")
  40. wait(2)
  41. createNotification("3")
  42. wait(2)
  43. createNotification("4")
  44. wait(2)
  45. createNotification("5")
  46. wait(2)
  47. createNotification("6")
  48. wait(2)
  49. createNotification("7")
  50. wait(2)
  51. createNotification("8")
  52. wait(2)
  53. createNotification("9")
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement