Advertisement
MaxproGlitcher

Test notif Max

Nov 10th, 2023
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.61 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService");
  2. local RunService = game:GetService("RunService");
  3. local TextService = game:GetService("TextService");
  4.  
  5. local Player = game:GetService("Players").LocalPlayer;
  6.  
  7. local NotifGui = Instance.new("ScreenGui");
  8. NotifGui.Name = "MaxproGlitcher";
  9. NotifGui.Parent = RunService:IsStudio() and Player.PlayerGui or game:GetService("CoreGui");
  10.  
  11. local Container = Instance.new("Frame");
  12. Container.Name = "Container";
  13. Container.Position = UDim2.new(0, 20, 0.5, -20);
  14. Container.Size = UDim2.new(0, 300, 0.5, 0);
  15. Container.BackgroundTransparency = 1;
  16. Container.Parent = NotifGui;
  17.  
  18. local function Image(ID, Button)
  19. local NewImage = Instance.new(string.format("Image%s", Button and "Button" or "Label"));
  20. NewImage.Image = ID;
  21. NewImage.BackgroundTransparency = 1;
  22. return NewImage;
  23. end
  24.  
  25. local function Round2px()
  26. local NewImage = Image("http://www.roblox.com/asset/?id=5761488251");
  27. NewImage.ScaleType = Enum.ScaleType.Slice;
  28. NewImage.SliceCenter = Rect.new(2, 2, 298, 298);
  29. NewImage.ImageColor3 = Color3.fromRGB(12, 4, 20);
  30. NewImage.ImageTransparency = 0.14
  31. return NewImage;
  32. end
  33.  
  34. local function Shadow2px()
  35. local NewImage = Image("http://www.roblox.com/asset/?id=5761498316");
  36. NewImage.ScaleType = Enum.ScaleType.Slice;
  37. NewImage.SliceCenter = Rect.new(17, 17, 283, 283);
  38. NewImage.Size = UDim2.fromScale(1, 1) + UDim2.fromOffset(30, 30);
  39. NewImage.Position = -UDim2.fromOffset(15, 15);
  40. NewImage.ImageColor3 = Color3.fromRGB(26, 26, 26);
  41. return NewImage;
  42. end
  43.  
  44. local Padding = 10;
  45. local DescriptionPadding = 10;
  46. local InstructionObjects = {};
  47. local TweenTime = 1;
  48. local TweenStyle = Enum.EasingStyle.Sine;
  49. local TweenDirection = Enum.EasingDirection.Out;
  50.  
  51. local LastTick = tick();
  52.  
  53. local function CalculateBounds(TableOfObjects)
  54. local TableOfObjects = typeof(TableOfObjects) == "table" and TableOfObjects or {};
  55. local X, Y = 0, 0;
  56. for _, Object in next, TableOfObjects do
  57. X += Object.AbsoluteSize.X;
  58. Y += Object.AbsoluteSize.Y;
  59. end
  60. return {X = X, Y = Y, x = X, y = Y};
  61. end
  62.  
  63. local CachedObjects = {};
  64.  
  65. local function Update()
  66. local DeltaTime = tick() - LastTick;
  67. local PreviousObjects = {};
  68. for CurObj, Object in next, InstructionObjects do
  69. local Label, Delta, Done = Object[1], Object[2], Object[3];
  70. if (not Done) then
  71. if (Delta < TweenTime) then
  72. Object[2] = math.clamp(Delta + DeltaTime, 0, 1);
  73. Delta = Object[2];
  74. else
  75. Object[3] = true;
  76. end
  77. end
  78. local NewValue = TweenService:GetValue(Delta, TweenStyle, TweenDirection);
  79. local CurrentPos = Label.Position;
  80. local PreviousBounds = CalculateBounds(PreviousObjects);
  81. local TargetPos = UDim2.new(0, 0, 0, PreviousBounds.Y + (Padding * #PreviousObjects));
  82. Label.Position = CurrentPos:Lerp(TargetPos, NewValue);
  83. table.insert(PreviousObjects, Label);
  84. end
  85. CachedObjects = PreviousObjects;
  86. LastTick = tick();
  87. end
  88.  
  89. RunService:BindToRenderStep("UpdateList", 0, Update);
  90.  
  91. local TitleSettings = {
  92. Font = Enum.Font.GothamSemibold;
  93. Size = 14;
  94. }
  95.  
  96. local DescriptionSettings = {
  97. Font = Enum.Font.Gotham;
  98. Size = 14;
  99. }
  100.  
  101. local MaxWidth = (Container.AbsoluteSize.X - Padding - DescriptionPadding);
  102.  
  103. local function Label(Text, Font, Size, Button)
  104. local Label = Instance.new(string.format("Text%s", Button and "Button" or "Label"));
  105. Label.Text = Text;
  106. Label.Font = Font;
  107. Label.TextSize = Size;
  108. Label.BackgroundTransparency = 1;
  109. Label.TextXAlignment = Enum.TextXAlignment.Left;
  110. Label.RichText = true;
  111. Label.TextColor3 = Color3.fromRGB(255, 255, 255);
  112. return Label;
  113. end
  114.  
  115. local function TitleLabel(Text)
  116. return Label(Text, TitleSettings.Font, TitleSettings.Size);
  117. end
  118.  
  119. local function DescriptionLabel(Text)
  120. return Label(Text, DescriptionSettings.Font, DescriptionSettings.Size);
  121. end
  122.  
  123. local PropertyTweenOut = {
  124. Text = "TextTransparency",
  125. Fram = "BackgroundTransparency",
  126. Imag = "ImageTransparency"
  127. }
  128.  
  129. local function FadeProperty(Object)
  130. local Prop = PropertyTweenOut[string.sub(Object.ClassName, 1, 4)];
  131. TweenService:Create(Object, TweenInfo.new(0.25, TweenStyle, TweenDirection), {
  132. [Prop] = 1;
  133. }):Play();
  134. end
  135.  
  136. local function SearchTableFor(Table, For)
  137. for _, v in next, Table do
  138. if (v == For) then
  139. return true;
  140. end
  141. end
  142. return false;
  143. end
  144.  
  145. local function FindIndexByDependency(Table, Dependency)
  146. for Index, Object in next, Table do
  147. if (typeof(Object) == "table") then
  148. local Found = SearchTableFor(Object, Dependency);
  149. if (Found) then
  150. return Index;
  151. end
  152. else
  153. if (Object == Dependency) then
  154. return Index;
  155. end
  156. end
  157. end
  158. end
  159.  
  160. local function ResetObjects()
  161. for _, Object in next, InstructionObjects do
  162. Object[2] = 0;
  163. Object[3] = false;
  164. end
  165. end
  166.  
  167. local function FadeOutAfter(Object, Seconds)
  168. wait(Seconds);
  169. FadeProperty(Object);
  170. for _, SubObj in next, Object:GetDescendants() do
  171. FadeProperty(SubObj);
  172. end
  173. wait(0.25);
  174. table.remove(InstructionObjects, FindIndexByDependency(InstructionObjects, Object));
  175. ResetObjects();
  176. Object.Visible = false
  177. end
  178.  
  179. return {
  180. Notify = function(Properties)
  181. local Properties = typeof(Properties) == "table" and Properties or {};
  182. local Title = Properties.Title;
  183. local Description = Properties.Description;
  184. local Duration = Properties.Duration or 5;
  185. if (Title) or (Description) then -- Check that user has provided title and/or description
  186. local Y = Title and 26 or 0;
  187. if (Description) then
  188. local TextSize = TextService:GetTextSize(Description, DescriptionSettings.Size, DescriptionSettings.Font, Vector2.new(0, 0));
  189. for i = 1, math.ceil(TextSize.X / MaxWidth) do
  190. Y += TextSize.Y;
  191. end
  192. Y += 8;
  193. end
  194. local NewLabel = Round2px();
  195. NewLabel.Size = UDim2.new(1, 0, 0, Y);
  196. NewLabel.Position = UDim2.new(-1, 20, 0, CalculateBounds(CachedObjects).Y + (Padding * #CachedObjects));
  197. if (Title) then
  198. local NewTitle = TitleLabel(Title);
  199. NewTitle.Size = UDim2.new(1, -10, 0, 26);
  200. NewTitle.Position = UDim2.fromOffset(10, 0);
  201. NewTitle.Parent = NewLabel;
  202. end
  203. if (Description) then
  204. local NewDescription = DescriptionLabel(Description);
  205. NewDescription.TextWrapped = true;
  206. NewDescription.Size = UDim2.fromScale(1, 1) + UDim2.fromOffset(-DescriptionPadding, Title and -26 or 0);
  207. NewDescription.Position = UDim2.fromOffset(10, Title and 26 or 0);
  208. NewDescription.TextYAlignment = Enum.TextYAlignment[Title and "Top" or "Center"];
  209. NewDescription.Parent = NewLabel;
  210. end
  211. Shadow2px().Parent = NewLabel;
  212. NewLabel.Parent = Container;
  213. table.insert(InstructionObjects, {NewLabel, 0, false});
  214. coroutine.wrap(FadeOutAfter)(NewLabel, Duration);
  215. end
  216. end,
  217. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement