ERROR_CODE

Notif

Oct 20th, 2023
4,499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 36.90 KB | None | 0 0
  1. _G.JxereasExistingHooks = _G.JxereasExistingHooks or {}
  2. if not _G.JxereasExistingHooks.GuiDetectionBypass then
  3.     local CoreGui = game.CoreGui
  4.     local ContentProvider = game.ContentProvider
  5.     local RobloxGuis = {"RobloxGui", "TeleportGui", "RobloxPromptGui", "RobloxLoadingGui", "PlayerList", "RobloxNetworkPauseNotification", "PurchasePrompt", "HeadsetDisconnectedDialog", "ThemeProvider", "DevConsoleMaster"}
  6.    
  7.     local function FilterTable(tbl)
  8.         local context = syn_context_get()
  9.         syn_context_set(7)
  10.         local new = {}
  11.         for i,v in ipairs(tbl) do --roblox iterates the array part
  12.             if typeof(v) ~= "Instance" then
  13.                 table.insert(new, v)
  14.             else
  15.                 if v == CoreGui or v == game then
  16.                     --insert only the default roblox guis
  17.                     for i,v in pairs(RobloxGuis) do
  18.                         local gui = CoreGui:FindFirstChild(v)
  19.                         if gui then
  20.                             table.insert(new, gui)
  21.                         end
  22.                     end
  23.    
  24.                     if v == game then
  25.                         for i,v in pairs(game:GetChildren()) do
  26.                             if v ~= CoreGui then
  27.                                 table.insert(new, v)
  28.                             end
  29.                         end
  30.                     end
  31.                 else
  32.                     if not CoreGui:IsAncestorOf(v) then
  33.                         table.insert(new, v)
  34.                     else
  35.                         --don't insert it if it's a descendant of a different gui than default roblox guis
  36.                         for j,k in pairs(RobloxGuis) do
  37.                             local gui = CoreGui:FindFirstChild(k)
  38.                             if gui then
  39.                                 if v == gui or gui:IsAncestorOf(v) then
  40.                                     table.insert(new, v)
  41.                                     break
  42.                                 end
  43.                             end
  44.                         end
  45.                     end
  46.                 end
  47.             end
  48.         end
  49.         syn_context_set(context)
  50.         return new
  51.     end
  52.    
  53.     local old
  54.     old = hookfunc(ContentProvider.PreloadAsync, function(self, tbl, cb)
  55.         if self ~= ContentProvider or type(tbl) ~= "table" or type(cb) ~= "function" then --note: callback can be nil but in that case it's useless anyways
  56.             return old(self, tbl, cb)
  57.         end
  58.    
  59.         --check for any errors that I might've missed (such as table being {[2] = "something"} which causes "Unable to cast to Array")
  60.         local err
  61.         task.spawn(function() --TIL pcalling a C yield function inside a C yield function is a bad idea ("cannot resume non-suspended coroutine")
  62.             local s,e = pcall(old, self, tbl)
  63.             if not s and e then
  64.                 err = e
  65.             end
  66.         end)
  67.        
  68.         if err then
  69.             return old(self, tbl) --don't pass the callback, just in case
  70.         end
  71.    
  72.         tbl = FilterTable(tbl)
  73.         return old(self, tbl, cb)
  74.     end)
  75.    
  76.     local old
  77.     old = hookmetamethod(game, "__namecall", function(self, ...)
  78.         local method = getnamecallmethod()
  79.         if self == ContentProvider and (method == "PreloadAsync" or method == "preloadAsync") then
  80.             local args = {...}
  81.             if type(args[1]) ~= "table" or type(args[2]) ~= "function" then
  82.                 return old(self, ...)
  83.             end
  84.    
  85.             local err
  86.             task.spawn(function()
  87.                 setnamecallmethod(method) --different thread, different namecall method
  88.                 local s,e = pcall(old, self, args[1])
  89.                 if not s and e then
  90.                     err = e
  91.                 end
  92.             end)
  93.    
  94.             if err then
  95.                 return old(self, args[1])
  96.             end
  97.    
  98.             args[1] = FilterTable(args[1])
  99.             setnamecallmethod(method)
  100.             return old(self, args[1], args[2])
  101.         end
  102.         return old(self, ...)
  103.     end)
  104.    
  105.     _G.JxereasExistingHooks.GuiDetectionBypass = true
  106. end
  107.  
  108. local Notification = {}
  109. Notification.__index = Notification
  110.  
  111. local ts = game:GetService("TweenService")
  112. local ss = game:GetService("SoundService")
  113. local txtS = game:GetService("TextService")
  114.  
  115. local openSound = Instance.new("Sound")
  116. local closeSound = Instance.new("Sound")
  117.  
  118. local notifications = Instance.new("ScreenGui")
  119. local notifsHolderFrame = Instance.new("Frame")
  120. local notifHolderListLayout = Instance.new("UIListLayout")
  121. local errorTemplate = Instance.new("Frame")
  122. local errorTemplateFrame = Instance.new("Frame")
  123. local errorTemplateCorner = Instance.new("UICorner")
  124. local errorSeverityFrame = Instance.new("Frame")
  125. local errorSeverityCorner = Instance.new("UICorner")
  126. local hideErrorSeverityCornerFrame = Instance.new("Frame")
  127. local errorImage = Instance.new("ImageLabel")
  128. local errorInformationFrame = Instance.new("Frame")
  129. local errorHeadingText = Instance.new("TextLabel")
  130. local errorBodyText = Instance.new("TextLabel")
  131. local errorCornerHidingFrame = Instance.new("Frame")
  132. local errorCloseButton = Instance.new("ImageButton")
  133. local infoTemplate = Instance.new("Frame")
  134. local infoTemplateFrame = Instance.new("Frame")
  135. local infoSeverityFrame = Instance.new("Frame")
  136. local infoSeverityCorner = Instance.new("UICorner")
  137. local hideInfoSeverityCornerFrame = Instance.new("Frame")
  138. local infoImage = Instance.new("ImageLabel")
  139. local infoInformationFrame = Instance.new("Frame")
  140. local infoHeadingText = Instance.new("TextLabel")
  141. local infoBodyText = Instance.new("TextLabel")
  142. local infoCornerHidingFrame = Instance.new("Frame")
  143. local infoCloseButton = Instance.new("ImageButton")
  144. local infoTemplateCorner = Instance.new("UICorner")
  145. local messageTemplate = Instance.new("Frame")
  146. local messageTemplateFrame = Instance.new("Frame")
  147. local messageTemplateCorner = Instance.new("UICorner")
  148. local messageSeverityFrame = Instance.new("Frame")
  149. local messageSeverityCorner = Instance.new("UICorner")
  150. local hideMessageSeverityCornerFrame = Instance.new("Frame")
  151. local messageInformationFrame = Instance.new("Frame")
  152. local messageHeadingText = Instance.new("TextLabel")
  153. local messageBodyText = Instance.new("TextLabel")
  154. local messageCornerHidingFrame = Instance.new("Frame")
  155. local messageCloseButton = Instance.new("ImageButton")
  156. local successTemplate = Instance.new("Frame")
  157. local successTemplateFrame = Instance.new("Frame")
  158. local successTemplateCorner = Instance.new("UICorner")
  159. local successSeverityFrame = Instance.new("Frame")
  160. local successSeverityCorner = Instance.new("UICorner")
  161. local hideSuccessSeverityCornerFrame = Instance.new("Frame")
  162. local successImage = Instance.new("ImageLabel")
  163. local successInformationFrame = Instance.new("Frame")
  164. local successHeadingText = Instance.new("TextLabel")
  165. local successBodyText = Instance.new("TextLabel")
  166. local successCornerHidingFrame = Instance.new("Frame")
  167. local successCloseButton = Instance.new("ImageButton")
  168. local warningTemplate = Instance.new("Frame")
  169. local warningTemplateFrame = Instance.new("Frame")
  170. local warningTemplateCorner = Instance.new("UICorner")
  171. local warningSeverityFrame = Instance.new("Frame")
  172. local warningSeverityCorner = Instance.new("UICorner")
  173. local hideWarningSeverityCornerFrame = Instance.new("Frame")
  174. local warningImage = Instance.new("ImageLabel")
  175. local warningInformationFrame = Instance.new("Frame")
  176. local warningHeadingText = Instance.new("TextLabel")
  177. local warningBodyText = Instance.new("TextLabel")
  178. local warningCornerHidingFrame = Instance.new("Frame")
  179. local warningCloseButton = Instance.new("ImageButton")
  180.  
  181. local previousUiExists = game:GetService("CoreGui"):FindFirstChild("notifications")
  182. if previousUiExists then previousUiExists:Destroy() end
  183.  
  184. openSound.Name = "OpenNotifSound"
  185. openSound.Volume = 1
  186. openSound.SoundId = "rbxassetid://9128519965"
  187. openSound.Parent = ss
  188.  
  189. closeSound.Name = "CloseNotifSound"
  190. closeSound.Volume = 1
  191. closeSound.SoundId = "rbxassetid://9128519965"
  192. closeSound.Parent = ss
  193.  
  194. notifications.Name = "notifications"
  195. notifications.Parent = game:GetService("CoreGui")
  196. notifications.ZIndexBehavior = Enum.ZIndexBehavior.Global
  197. notifications.ResetOnSpawn = false
  198.  
  199. notifsHolderFrame.Name = "notifsHolderFrame"
  200. notifsHolderFrame.Parent = notifications
  201. notifsHolderFrame.AnchorPoint = Vector2.new(1, 1)
  202. notifsHolderFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  203. notifsHolderFrame.BackgroundTransparency = 1
  204. notifsHolderFrame.BorderSizePixel = 0
  205. notifsHolderFrame.ClipsDescendants = true
  206. notifsHolderFrame.Position = UDim2.new(1, 0, 1, -10)
  207. notifsHolderFrame.Size = UDim2.fromScale(0.25, 0.3)
  208.  
  209. notifHolderListLayout.Name = "notifHolderListLayout"
  210. notifHolderListLayout.Parent = notifsHolderFrame
  211. notifHolderListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  212. notifHolderListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
  213. notifHolderListLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
  214. notifHolderListLayout.Padding = UDim.new(0, 4)
  215.  
  216. errorTemplate.Name = "error"
  217. errorTemplate.AnchorPoint = Vector2.new(1, 1)
  218. errorTemplate.BackgroundColor3 = Color3.fromRGB(255, 207, 203)
  219. errorTemplate.BorderSizePixel = 0
  220. errorTemplate.BackgroundTransparency = 1
  221. errorTemplate.Position = UDim2.new(1, 0, 1, -100)
  222. errorTemplate.Size = UDim2.new(1, 0, 0, 40)
  223.  
  224. errorTemplateFrame.Name = "templateFrame"
  225. errorTemplateFrame.Parent = errorTemplate
  226. errorTemplateFrame.BackgroundColor3 = Color3.fromRGB(255, 207, 203)
  227. errorTemplateFrame.BorderSizePixel = 0
  228. errorTemplateFrame.Size = UDim2.new(1, 0, 1, 0)
  229.  
  230. errorTemplateCorner.Name = "templateCorner"
  231. errorTemplateCorner.Parent = errorTemplateFrame
  232.  
  233. errorSeverityFrame.Name = "severityFrame"
  234. errorSeverityFrame.Parent = errorTemplateFrame
  235. errorSeverityFrame.BackgroundColor3 = Color3.fromRGB(236, 88, 76)
  236. errorSeverityFrame.Size = UDim2.new(0, 10, 1, 0)
  237.  
  238. errorSeverityCorner.Name = "severityCorner"
  239. errorSeverityCorner.Parent = errorSeverityFrame
  240.  
  241. hideErrorSeverityCornerFrame.Name = "hideSeverityCornerFrame"
  242. hideErrorSeverityCornerFrame.Parent = errorSeverityFrame
  243. hideErrorSeverityCornerFrame.BackgroundColor3 = Color3.fromRGB(255, 207, 203)
  244. hideErrorSeverityCornerFrame.BorderSizePixel = 0
  245. hideErrorSeverityCornerFrame.Position = UDim2.new(0.5, 0, 0, 0)
  246. hideErrorSeverityCornerFrame.Size = UDim2.new(0.5, 0, 1, 0)
  247.  
  248. errorImage.Name = "image"
  249. errorImage.Parent = errorTemplateFrame
  250. errorImage.AnchorPoint = Vector2.new(0, 0.5)
  251. errorImage.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  252. errorImage.BackgroundTransparency = 1
  253. errorImage.BorderSizePixel = 0
  254. errorImage.Position = UDim2.new(0, 15, 0.5, 0)
  255. errorImage.Size = UDim2.new(0, 20, 0, 20)
  256. errorImage.Image = "rbxassetid://9072920609"
  257. errorImage.ImageColor3 = Color3.fromRGB(236, 88, 76)
  258.  
  259. errorInformationFrame.Name = "informationFrame"
  260. errorInformationFrame.Parent = errorTemplateFrame
  261. errorInformationFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  262. errorInformationFrame.BackgroundTransparency = 1
  263. errorInformationFrame.BorderSizePixel = 0
  264. errorInformationFrame.Position = UDim2.new(0, 45, 0, 0)
  265. errorInformationFrame.Size = UDim2.new(1, -45 - 25, 1, 0)
  266.  
  267. errorHeadingText.Name = "headingText"
  268. errorHeadingText.Parent = errorInformationFrame
  269. errorHeadingText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  270. errorHeadingText.BackgroundTransparency = 1
  271. errorHeadingText.BorderSizePixel = 0
  272. errorHeadingText.ClipsDescendants = true
  273. errorHeadingText.Size = UDim2.new(1, 0, 0, 20)
  274. errorHeadingText.Font = Enum.Font.GothamBold
  275. errorHeadingText.Text = "Error"
  276. errorHeadingText.TextColor3 = Color3.fromRGB(0, 0, 0)
  277. errorHeadingText.TextSize = 14
  278. errorHeadingText.TextXAlignment = Enum.TextXAlignment.Left
  279. errorHeadingText.TextYAlignment = Enum.TextYAlignment.Bottom
  280.  
  281. errorBodyText.Name = "bodyText"
  282. errorBodyText.Parent = errorInformationFrame
  283. errorBodyText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  284. errorBodyText.BackgroundTransparency = 1
  285. errorBodyText.BorderSizePixel = 0
  286. errorBodyText.ClipsDescendants = true
  287. errorBodyText.Position = UDim2.new(0, 0, 0, 20)
  288. errorBodyText.Size = UDim2.new(1, 0, 1, -20)
  289. errorBodyText.Font = Enum.Font.GothamSemibold
  290. errorBodyText.Text = "Error message"
  291. errorBodyText.TextColor3 = Color3.fromRGB(0, 0, 0)
  292. errorBodyText.TextSize = 14
  293. errorBodyText.TextWrapped = true
  294. errorBodyText.TextXAlignment = Enum.TextXAlignment.Left
  295. errorBodyText.TextYAlignment = Enum.TextYAlignment.Top
  296.  
  297. errorCornerHidingFrame.Name = "cornerHidingFrame"
  298. errorCornerHidingFrame.Parent = errorTemplateFrame
  299. errorCornerHidingFrame.AnchorPoint = Vector2.new(1, 0)
  300. errorCornerHidingFrame.BackgroundColor3 = Color3.fromRGB(255, 207, 203)
  301. errorCornerHidingFrame.BorderSizePixel = 0
  302. errorCornerHidingFrame.Position = UDim2.new(1, 0, 0, 0)
  303. errorCornerHidingFrame.Size = UDim2.new(.1, 0, 1, 0)
  304. errorCornerHidingFrame.ZIndex = 0
  305.  
  306. errorCloseButton.Name = "closeButton"
  307. errorCloseButton.Parent = errorTemplateFrame
  308. errorCloseButton.AnchorPoint = Vector2.new(1, 0.5)
  309. errorCloseButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  310. errorCloseButton.BackgroundTransparency = 1
  311. errorCloseButton.BorderSizePixel = 0
  312. errorCloseButton.Position = UDim2.new(1, -5, 0.5, 0)
  313. errorCloseButton.Size = UDim2.new(0, 15, 0, 15)
  314. errorCloseButton.Image = "rbxassetid://9127564477"
  315. errorCloseButton.ImageColor3 = Color3.fromRGB(236, 88, 76)
  316.  
  317. infoTemplate.Name = "info"
  318. infoTemplate.AnchorPoint = Vector2.new(1, 1)
  319. infoTemplate.BackgroundColor3 = Color3.fromRGB(204, 226, 254)
  320. infoTemplate.BorderSizePixel = 0
  321. infoTemplate.BackgroundTransparency = 1
  322. infoTemplate.Position = UDim2.new(1, 0, 1, -100)
  323. infoTemplate.Size = UDim2.new(1, 0, 0, 40)
  324.  
  325. infoTemplateFrame.Name = "templateFrame"
  326. infoTemplateFrame.Parent = infoTemplate
  327. infoTemplateFrame.BackgroundColor3 = Color3.fromRGB(204, 226, 254)
  328. infoTemplateFrame.BorderSizePixel = 0
  329. infoTemplateFrame.Size = UDim2.new(1, 0, 1, 0)
  330.  
  331. infoSeverityFrame.Name = "severityFrame"
  332. infoSeverityFrame.Parent = infoTemplateFrame
  333. infoSeverityFrame.BackgroundColor3 = Color3.fromRGB(50, 131, 226)
  334. infoSeverityFrame.Size = UDim2.new(0, 10, 1, 0)
  335.  
  336. infoSeverityCorner.Name = "severityCorner"
  337. infoSeverityCorner.Parent = infoSeverityFrame
  338.  
  339. hideInfoSeverityCornerFrame.Name = "hideSeverityCornerFrame"
  340. hideInfoSeverityCornerFrame.Parent = infoSeverityFrame
  341. hideInfoSeverityCornerFrame.BackgroundColor3 = Color3.fromRGB(204, 226, 254)
  342. hideInfoSeverityCornerFrame.BorderSizePixel = 0
  343. hideInfoSeverityCornerFrame.Position = UDim2.new(0.5, 0, 0, 0)
  344. hideInfoSeverityCornerFrame.Size = UDim2.new(0.5, 0, 1, 0)
  345.  
  346. infoImage.Name = "image"
  347. infoImage.Parent = infoTemplateFrame
  348. infoImage.AnchorPoint = Vector2.new(0, 0.5)
  349. infoImage.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  350. infoImage.BackgroundTransparency = 1
  351. infoImage.BorderSizePixel = 0
  352. infoImage.Position = UDim2.new(0, 15, 0.5, 0)
  353. infoImage.Size = UDim2.new(0, 20, 0, 20)
  354. infoImage.Image = "rbxassetid://9072944922"
  355. infoImage.ImageColor3 = Color3.fromRGB(50, 131, 226)
  356.  
  357. infoInformationFrame.Name = "informationFrame"
  358. infoInformationFrame.Parent = infoTemplateFrame
  359. infoInformationFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  360. infoInformationFrame.BackgroundTransparency = 1
  361. infoInformationFrame.BorderSizePixel = 0
  362. infoInformationFrame.Position = UDim2.new(0, 45, 0, 0)
  363. infoInformationFrame.Size = UDim2.new(1, -45 - 25, 1, 0)
  364.  
  365. infoHeadingText.Name = "headingText"
  366. infoHeadingText.Parent = infoInformationFrame
  367. infoHeadingText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  368. infoHeadingText.BackgroundTransparency = 1
  369. infoHeadingText.BorderSizePixel = 0
  370. infoHeadingText.ClipsDescendants = true
  371. infoHeadingText.Size = UDim2.new(1, 0, 0, 20)
  372. infoHeadingText.Font = Enum.Font.GothamBold
  373. infoHeadingText.Text = "Information"
  374. infoHeadingText.TextColor3 = Color3.fromRGB(0, 0, 0)
  375. infoHeadingText.TextSize = 14
  376. infoHeadingText.TextXAlignment = Enum.TextXAlignment.Left
  377. infoHeadingText.TextYAlignment = Enum.TextYAlignment.Bottom
  378.  
  379. infoBodyText.Name = "bodyText"
  380. infoBodyText.Parent = infoInformationFrame
  381. infoBodyText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  382. infoBodyText.BackgroundTransparency = 1
  383. infoBodyText.BorderSizePixel = 0
  384. infoBodyText.ClipsDescendants = true
  385. infoBodyText.Position = UDim2.new(0, 0, 0, 20)
  386. infoBodyText.Size = UDim2.new(1, 0, 1, -20)
  387. infoBodyText.Font = Enum.Font.GothamSemibold
  388. infoBodyText.Text = "Information message"
  389. infoBodyText.TextColor3 = Color3.fromRGB(0, 0, 0)
  390. infoBodyText.TextSize = 14
  391. infoBodyText.TextWrapped = true
  392. infoBodyText.TextXAlignment = Enum.TextXAlignment.Left
  393. infoBodyText.TextYAlignment = Enum.TextYAlignment.Top
  394.  
  395.  
  396. infoCornerHidingFrame.Name = "cornerHidingFrame"
  397. infoCornerHidingFrame.Parent = infoTemplateFrame
  398. infoCornerHidingFrame.AnchorPoint = Vector2.new(1, 0)
  399. infoCornerHidingFrame.BackgroundColor3 = Color3.fromRGB(204, 226, 254)
  400. infoCornerHidingFrame.BorderSizePixel = 0
  401. infoCornerHidingFrame.Position = UDim2.new(1, 0, 0, 0)
  402. infoCornerHidingFrame.Size = UDim2.new(.1, 0, 1, 0)
  403. infoCornerHidingFrame.ZIndex = 0
  404.  
  405. infoCloseButton.Name = "closeButton"
  406. infoCloseButton.Parent = infoTemplateFrame
  407. infoCloseButton.AnchorPoint = Vector2.new(1, 0.5)
  408. infoCloseButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  409. infoCloseButton.BackgroundTransparency = 1
  410. infoCloseButton.BorderSizePixel = 0
  411. infoCloseButton.Position = UDim2.new(1, -5, 0.5, 0)
  412. infoCloseButton.Size = UDim2.new(0, 15, 0, 15)
  413. infoCloseButton.Image = "rbxassetid://9127564477"
  414. infoCloseButton.ImageColor3 = Color3.fromRGB(50, 131, 226)
  415.  
  416. infoTemplateCorner.Name = "templateCorner"
  417. infoTemplateCorner.Parent = infoTemplateFrame
  418.  
  419. messageTemplate.Name = "message"
  420. messageTemplate.AnchorPoint = Vector2.new(1, 1)
  421. messageTemplate.BackgroundColor3 = Color3.fromRGB(233, 233, 235)
  422. messageTemplate.BorderSizePixel = 0
  423. messageTemplate.BackgroundTransparency = 1
  424. messageTemplate.Position = UDim2.new(1, 0, 1, -100)
  425. messageTemplate.Size = UDim2.new(1, 0, 0, 40)
  426.  
  427. messageTemplateFrame.Name = "templateFrame"
  428. messageTemplateFrame.Parent = messageTemplate
  429. messageTemplateFrame.BackgroundColor3 = Color3.fromRGB(233, 233, 235)
  430. messageTemplateFrame.BorderSizePixel = 0
  431. messageTemplateFrame.Size = UDim2.new(1, 0, 1, 0)
  432.  
  433. messageTemplateCorner.Name = "templateCorner"
  434. messageTemplateCorner.Parent = messageTemplateFrame
  435.  
  436. messageSeverityFrame.Name = "severityFrame"
  437. messageSeverityFrame.Parent = messageTemplateFrame
  438. messageSeverityFrame.BackgroundColor3 = Color3.fromRGB(112, 118, 130)
  439. messageSeverityFrame.Size = UDim2.new(0, 10, 1, 0)
  440.  
  441. messageSeverityCorner.Name = "severityCorner"
  442. messageSeverityCorner.Parent = messageSeverityFrame
  443.  
  444. hideMessageSeverityCornerFrame.Name = "hideSeverityCornerFrame"
  445. hideMessageSeverityCornerFrame.Parent = messageSeverityFrame
  446. hideMessageSeverityCornerFrame.BackgroundColor3 = Color3.fromRGB(233, 233, 235)
  447. hideMessageSeverityCornerFrame.BorderSizePixel = 0
  448. hideMessageSeverityCornerFrame.Position = UDim2.new(0.5, 0, 0, 0)
  449. hideMessageSeverityCornerFrame.Size = UDim2.new(0.5, 0, 1, 0)
  450.  
  451. messageInformationFrame.Name = "informationFrame"
  452. messageInformationFrame.Parent = messageTemplateFrame
  453. messageInformationFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  454. messageInformationFrame.BackgroundTransparency = 1
  455. messageInformationFrame.BorderSizePixel = 0
  456. messageInformationFrame.Position = UDim2.new(0, 15, 0, 0)
  457. messageInformationFrame.Size = UDim2.new(1, -40, 1, 0)
  458.  
  459. messageHeadingText.Name = "headingText"
  460. messageHeadingText.Parent = messageInformationFrame
  461. messageHeadingText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  462. messageHeadingText.BackgroundTransparency = 1
  463. messageHeadingText.BorderSizePixel = 0
  464. messageHeadingText.ClipsDescendants = true
  465. messageHeadingText.Size = UDim2.new(1, 0, 0, 20)
  466. messageHeadingText.Font = Enum.Font.GothamBold
  467. messageHeadingText.Text = "Custom message"
  468. messageHeadingText.TextColor3 = Color3.fromRGB(0, 0, 0)
  469. messageHeadingText.TextSize = 14
  470. messageHeadingText.TextXAlignment = Enum.TextXAlignment.Left
  471. messageHeadingText.TextYAlignment = Enum.TextYAlignment.Bottom
  472.  
  473. messageBodyText.Name = "bodyText"
  474. messageBodyText.Parent = messageInformationFrame
  475. messageBodyText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  476. messageBodyText.BackgroundTransparency = 1
  477. messageBodyText.BorderSizePixel = 0
  478. messageBodyText.ClipsDescendants = true
  479. messageBodyText.Position = UDim2.new(0, 0, 0, 20)
  480. messageBodyText.Size = UDim2.new(1, 0, 1, -20)
  481. messageBodyText.Font = Enum.Font.GothamSemibold
  482. messageBodyText.Text = "Custom message"
  483. messageBodyText.TextColor3 = Color3.fromRGB(0, 0, 0)
  484. messageBodyText.TextSize = 14
  485. messageBodyText.TextWrapped = true
  486. messageBodyText.TextXAlignment = Enum.TextXAlignment.Left
  487. messageBodyText.TextYAlignment = Enum.TextYAlignment.Top
  488.  
  489. messageCornerHidingFrame.Name = "cornerHidingFrame"
  490. messageCornerHidingFrame.Parent = messageTemplateFrame
  491. messageCornerHidingFrame.AnchorPoint = Vector2.new(1, 0)
  492. messageCornerHidingFrame.BackgroundColor3 = Color3.fromRGB(233, 233, 235)
  493. messageCornerHidingFrame.BorderSizePixel = 0
  494. messageCornerHidingFrame.Position = UDim2.new(1, 0, 0, 0)
  495. messageCornerHidingFrame.Size = UDim2.new(.1, 0, 1, 0)
  496. messageCornerHidingFrame.ZIndex = 0
  497.  
  498. messageCloseButton.Name = "closeButton"
  499. messageCloseButton.Parent = messageTemplateFrame
  500. messageCloseButton.AnchorPoint = Vector2.new(1, 0.5)
  501. messageCloseButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  502. messageCloseButton.BackgroundTransparency = 1
  503. messageCloseButton.BorderSizePixel = 0
  504. messageCloseButton.Position = UDim2.new(1, -5, 0.5, 0)
  505. messageCloseButton.Size = UDim2.new(0, 15, 0, 15)
  506. messageCloseButton.Image = "rbxassetid://9127564477"
  507. messageCloseButton.ImageColor3 = Color3.fromRGB(112, 118, 130)
  508.  
  509. successTemplate.Name = "success"
  510. successTemplate.AnchorPoint = Vector2.new(1, 1)
  511. successTemplate.BackgroundColor3 = Color3.fromRGB(196, 247, 221)
  512. successTemplate.BorderSizePixel = 0
  513. successTemplate.BackgroundTransparency = 1
  514. successTemplate.Position = UDim2.new(1, 0, 1, -100)
  515. successTemplate.Size = UDim2.new(1, 0, 0, 40)
  516.  
  517. successTemplateFrame.Name = "templateFrame"
  518. successTemplateFrame.Parent = successTemplate
  519. successTemplateFrame.BackgroundColor3 = Color3.fromRGB(196, 247, 221)
  520. successTemplateFrame.BorderSizePixel = 0
  521. successTemplateFrame.Size = UDim2.new(1, 0, 1, 0)
  522.  
  523. successTemplateCorner.Name = "templateCorner"
  524. successTemplateCorner.Parent = successTemplateFrame
  525.  
  526. successSeverityFrame.Name = "severityFrame"
  527. successSeverityFrame.Parent = successTemplateFrame
  528. successSeverityFrame.BackgroundColor3 = Color3.fromRGB(50, 195, 125)
  529. successSeverityFrame.Size = UDim2.new(0, 10, 1, 0)
  530.  
  531. successSeverityCorner.Name = "severityCorner"
  532. successSeverityCorner.Parent = successSeverityFrame
  533.  
  534. hideSuccessSeverityCornerFrame.Name = "hideSeverityCornerFrame"
  535. hideSuccessSeverityCornerFrame.Parent = successSeverityFrame
  536. hideSuccessSeverityCornerFrame.BackgroundColor3 = Color3.fromRGB(196, 247, 221)
  537. hideSuccessSeverityCornerFrame.BorderSizePixel = 0
  538. hideSuccessSeverityCornerFrame.Position = UDim2.new(0.5, 0, 0, 0)
  539. hideSuccessSeverityCornerFrame.Size = UDim2.new(0.5, 0, 1, 0)
  540.  
  541. successImage.Name = "image"
  542. successImage.Parent = successTemplateFrame
  543. successImage.AnchorPoint = Vector2.new(0, 0.5)
  544. successImage.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  545. successImage.BackgroundTransparency = 1
  546. successImage.BorderSizePixel = 0
  547. successImage.Position = UDim2.new(0, 15, 0.5, 0)
  548. successImage.Size = UDim2.new(0, 20, 0, 20)
  549. successImage.Image = "rbxassetid://9073052584"
  550. successImage.ImageColor3 = Color3.fromRGB(50, 195, 125)
  551.  
  552. successInformationFrame.Name = "informationFrame"
  553. successInformationFrame.Parent = successTemplateFrame
  554. successInformationFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  555. successInformationFrame.BackgroundTransparency = 1
  556. successInformationFrame.BorderSizePixel = 0
  557. successInformationFrame.Position = UDim2.new(0, 45, 0, 0)
  558. successInformationFrame.Size = UDim2.new(1, -45 - 25, 1, 0)
  559.  
  560. successHeadingText.Name = "headingText"
  561. successHeadingText.Parent = successInformationFrame
  562. successHeadingText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  563. successHeadingText.BackgroundTransparency = 1
  564. successHeadingText.BorderSizePixel = 0
  565. successHeadingText.ClipsDescendants = true
  566. successHeadingText.Size = UDim2.new(1, 0, 0, 20)
  567. successHeadingText.Font = Enum.Font.GothamBold
  568. successHeadingText.Text = "Success"
  569. successHeadingText.TextColor3 = Color3.fromRGB(0, 0, 0)
  570. successHeadingText.TextSize = 14
  571. successHeadingText.TextXAlignment = Enum.TextXAlignment.Left
  572. successHeadingText.TextYAlignment = Enum.TextYAlignment.Bottom
  573.  
  574. successBodyText.Name = "bodyText"
  575. successBodyText.Parent = successInformationFrame
  576. successBodyText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  577. successBodyText.BackgroundTransparency = 1
  578. successBodyText.BorderSizePixel = 0
  579. successBodyText.ClipsDescendants = true
  580. successBodyText.Position = UDim2.new(0, 0, 0, 20)
  581. successBodyText.Size = UDim2.new(1, 0, 1, -20)
  582. successBodyText.Font = Enum.Font.GothamSemibold
  583. successBodyText.Text = "Success message"
  584. successBodyText.TextColor3 = Color3.fromRGB(0, 0, 0)
  585. successBodyText.TextSize = 14
  586. successBodyText.TextWrapped = true
  587. successBodyText.TextXAlignment = Enum.TextXAlignment.Left
  588. successBodyText.TextYAlignment = Enum.TextYAlignment.Top
  589.  
  590. successCornerHidingFrame.Name = "cornerHidingFrame"
  591. successCornerHidingFrame.Parent = successTemplateFrame
  592. successCornerHidingFrame.AnchorPoint = Vector2.new(1, 0)
  593. successCornerHidingFrame.BackgroundColor3 = Color3.fromRGB(196, 247, 221)
  594. successCornerHidingFrame.BorderSizePixel = 0
  595. successCornerHidingFrame.Position = UDim2.new(1, 0, 0, 0)
  596. successCornerHidingFrame.Size = UDim2.new(.1, 0, 1, 0)
  597. successCornerHidingFrame.ZIndex = 0
  598.  
  599. successCloseButton.Name = "closeButton"
  600. successCloseButton.Parent = successTemplateFrame
  601. successCloseButton.AnchorPoint = Vector2.new(1, 0.5)
  602. successCloseButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  603. successCloseButton.BackgroundTransparency = 1
  604. successCloseButton.BorderSizePixel = 0
  605. successCloseButton.Position = UDim2.new(1, -5, 0.5, 0)
  606. successCloseButton.Size = UDim2.new(0, 15, 0, 15)
  607. successCloseButton.Image = "rbxassetid://9127564477"
  608. successCloseButton.ImageColor3 = Color3.fromRGB(50, 195, 125)
  609.  
  610. warningTemplate.Name = "warning"
  611. warningTemplate.AnchorPoint = Vector2.new(1, 1)
  612. warningTemplate.BackgroundColor3 = Color3.fromRGB(255, 232, 197)
  613. warningTemplate.BorderSizePixel = 0
  614. warningTemplate.BackgroundTransparency = 1
  615. warningTemplate.Position = UDim2.new(1, 0, 1, -100)
  616. warningTemplate.Size = UDim2.new(1, 0, 0, 40)
  617.  
  618. warningTemplateFrame.Name = "templateFrame"
  619. warningTemplateFrame.Parent = warningTemplate
  620. warningTemplateFrame.BackgroundColor3 = Color3.fromRGB(255, 232, 197)
  621. warningTemplateFrame.BorderSizePixel = 0
  622. warningTemplateFrame.Size = UDim2.new(1, 0, 1, 0)
  623.  
  624. warningTemplateCorner.Name = "templateCorner"
  625. warningTemplateCorner.Parent = warningTemplateFrame
  626.  
  627. warningSeverityFrame.Name = "severityFrame"
  628. warningSeverityFrame.Parent = warningTemplateFrame
  629. warningSeverityFrame.BackgroundColor3 = Color3.fromRGB(234, 159, 53)
  630. warningSeverityFrame.Size = UDim2.new(0, 10, 1, 0)
  631.  
  632. warningSeverityCorner.Name = "severityCorner"
  633. warningSeverityCorner.Parent = warningSeverityFrame
  634.  
  635. hideWarningSeverityCornerFrame.Name = "hideSeverityCornerFrame"
  636. hideWarningSeverityCornerFrame.Parent = warningSeverityFrame
  637. hideWarningSeverityCornerFrame.BackgroundColor3 = Color3.fromRGB(255, 232, 197)
  638. hideWarningSeverityCornerFrame.BorderSizePixel = 0
  639. hideWarningSeverityCornerFrame.Position = UDim2.new(0.5, 0, 0, 0)
  640. hideWarningSeverityCornerFrame.Size = UDim2.new(0.5, 0, 1, 0)
  641.  
  642. warningImage.Name = "image"
  643. warningImage.Parent = warningTemplateFrame
  644. warningImage.AnchorPoint = Vector2.new(0, 0.5)
  645. warningImage.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  646. warningImage.BackgroundTransparency = 1
  647. warningImage.BorderSizePixel = 0
  648. warningImage.Position = UDim2.new(0, 15, 0.5, 0)
  649. warningImage.Size = UDim2.new(0, 20, 0, 20)
  650. warningImage.Image = "rbxassetid://9072448788"
  651. warningImage.ImageColor3 = Color3.fromRGB(234, 159, 53)
  652.  
  653. warningInformationFrame.Name = "informationFrame"
  654. warningInformationFrame.Parent = warningTemplateFrame
  655. warningInformationFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  656. warningInformationFrame.BackgroundTransparency = 1
  657. warningInformationFrame.BorderSizePixel = 0
  658. warningInformationFrame.Position = UDim2.new(0, 45, 0, 0)
  659. warningInformationFrame.Size = UDim2.new(1, -45 - 25, 1, 0)
  660.  
  661. warningHeadingText.Name = "headingText"
  662. warningHeadingText.Parent = warningInformationFrame
  663. warningHeadingText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  664. warningHeadingText.BackgroundTransparency = 1
  665. warningHeadingText.BorderSizePixel = 0
  666. warningHeadingText.ClipsDescendants = true
  667. warningHeadingText.Size = UDim2.new(1, 0, 0, 20)
  668. warningHeadingText.Font = Enum.Font.GothamBold
  669. warningHeadingText.Text = "Warning"
  670. warningHeadingText.TextColor3 = Color3.fromRGB(0, 0, 0)
  671. warningHeadingText.TextSize = 14
  672. warningHeadingText.TextXAlignment = Enum.TextXAlignment.Left
  673. warningHeadingText.TextYAlignment = Enum.TextYAlignment.Bottom
  674.  
  675. warningBodyText.Name = "bodyText"
  676. warningBodyText.Parent = warningInformationFrame
  677. warningBodyText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  678. warningBodyText.BackgroundTransparency = 1
  679. warningBodyText.BorderSizePixel = 0
  680. warningBodyText.ClipsDescendants = true
  681. warningBodyText.Position = UDim2.new(0, 0, 0, 20)
  682. warningBodyText.Size = UDim2.new(1, 0, 1, -20)
  683. warningBodyText.Font = Enum.Font.GothamSemibold
  684. warningBodyText.Text = "Warning message"
  685. warningBodyText.TextColor3 = Color3.fromRGB(0, 0, 0)
  686. warningBodyText.TextSize = 14
  687. warningBodyText.TextWrapped = true
  688. warningBodyText.TextXAlignment = Enum.TextXAlignment.Left
  689. warningBodyText.TextYAlignment = Enum.TextYAlignment.Top
  690.  
  691. warningCornerHidingFrame.Name = "cornerHidingFrame"
  692. warningCornerHidingFrame.Parent = warningTemplateFrame
  693. warningCornerHidingFrame.AnchorPoint = Vector2.new(1, 0)
  694. warningCornerHidingFrame.BackgroundColor3 = Color3.fromRGB(255, 232, 197)
  695. warningCornerHidingFrame.BorderSizePixel = 0
  696. warningCornerHidingFrame.Position = UDim2.new(1, 0, 0, 0)
  697. warningCornerHidingFrame.Size = UDim2.new(.1, 0, 1, 0)
  698. warningCornerHidingFrame.ZIndex = 0
  699.  
  700. warningCloseButton.Name = "closeButton"
  701. warningCloseButton.Parent = warningTemplateFrame
  702. warningCloseButton.AnchorPoint = Vector2.new(1, 0.5)
  703. warningCloseButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  704. warningCloseButton.BackgroundTransparency = 1
  705. warningCloseButton.BorderSizePixel = 0
  706. warningCloseButton.Position = UDim2.new(1, -5, 0.5, 0)
  707. warningCloseButton.Size = UDim2.new(0, 15, 0, 15)
  708. warningCloseButton.Image = "rbxassetid://9127564477"
  709. warningCloseButton.ImageColor3 = Color3.fromRGB(234, 159, 53)
  710.  
  711. local function scaleNotifHolderMaxNotifs(): nil
  712.     local amountOfNotifsInFrame = math.floor(notifsHolderFrame.AbsoluteSize.Y/40)
  713.     local notifsHolderFramePadding = amountOfNotifsInFrame * notifHolderListLayout.Padding.Offset
  714.     notifsHolderFrame.Size = UDim2.new(.25,0,0,amountOfNotifsInFrame * 40 + notifsHolderFramePadding)
  715. end
  716.  
  717. local function deleteNotifsOutsideFrame(): nil
  718.     if notifHolderListLayout.AbsoluteContentSize.Y < notifsHolderFrame.AbsoluteSize.Y then return end
  719.     for _, notif in pairs(notifsHolderFrame:GetChildren()) do
  720.         if not notif:IsA("Frame") then continue end
  721.         if notif.AbsolutePosition.Y > notifsHolderFrame.AbsolutePosition.Y then continue end
  722.         notif:Destroy()
  723.     end
  724. end
  725.  
  726. function Notification.new(notifType: string, heading: string, body: string, autoRemove: boolean, autoRemoveTime: number, callback): table
  727.     local notificationTypes = {
  728.         ["error"] = errorTemplate,
  729.         ["info"] = infoTemplate,
  730.         ["message"] = messageTemplate,
  731.         ["success"] = successTemplate,
  732.         ["warning"] = warningTemplate
  733.     }
  734.  
  735.     local notif = notificationTypes[notifType:lower()]
  736.     assert(notif, "Notification type not valid\nValid Types: {\n\tError\n\tInfo\n\tMessage\n\tSuccess\n\tWarning\n}")
  737.     notif = notif:Clone()
  738.     notif.templateFrame.Position = UDim2.new(1,0,0,0)
  739.  
  740.     local function checkTextSize()
  741.         local infoFrame = notif.templateFrame.informationFrame
  742.         local requiredHeadingSize = txtS:GetTextSize(infoFrame.headingText.Text, infoFrame.headingText.TextSize, infoFrame.headingText.Font, Vector2.new(10000,10000)).X
  743.         local requiredBodySize = txtS:GetTextSize(infoFrame.bodyText.Text, infoFrame.bodyText.TextSize, infoFrame.bodyText.Font, Vector2.new(10000,10000)).X  
  744.         if requiredHeadingSize + 45 + 25 > notifsHolderFrame.AbsoluteSize.X then
  745.             warn("Heading size is too long (Notification Library)")
  746.         end
  747.         if requiredBodySize + 45 + 25 > notifsHolderFrame.AbsoluteSize.X then
  748.             warn("Body size is too long (Notification Library)")
  749.         end
  750.     end
  751.  
  752.     local function openNotif(): nil
  753.         local function playOpenNotifTween(): nil
  754.             ts:Create(notif.templateFrame, TweenInfo.new(.25), {Position = UDim2.new(0,0,0,0)}):Play()
  755.         end
  756.  
  757.         openSound:Play()
  758.         playOpenNotifTween()
  759.     end
  760.  
  761.     local function closeNotif(): nil
  762.         coroutine.wrap(function()
  763.             local function playCloseNotifTween(): nil
  764.                 local closeTween = ts:Create(notif.templateFrame, TweenInfo.new(.25), {Position = UDim2.new(1,0,0,0)})
  765.                 closeTween:Play()
  766.                 closeTween.Completed:Wait()
  767.             end
  768.            
  769.             closeSound:Play()
  770.             if callback then callback() end
  771.             playCloseNotifTween()
  772.             notif:Destroy()
  773.         end)()
  774.     end
  775.  
  776.     notif.templateFrame.closeButton.MouseButton1Click:Connect(closeNotif)
  777.     notif.templateFrame.informationFrame.headingText.Text = heading
  778.     notif.templateFrame.informationFrame.bodyText.Text = body
  779.     notif.Parent = notifsHolderFrame
  780.     checkTextSize()
  781.     openNotif()
  782.  
  783.     if autoRemove then
  784.         coroutine.wrap(function()
  785.             autoRemoveTime = autoRemoveTime or 5
  786.             task.wait(autoRemoveTime)
  787.             if notif and notif:FindFirstChild("templateFrame") then
  788.                 closeNotif()
  789.             end
  790.         end)()
  791.     end
  792.  
  793.     local newNotif = setmetatable({}, Notification)
  794.     newNotif.Instance = notif
  795.     newNotif.Heading = heading
  796.     newNotif.Body = body
  797.     newNotif.Type = notifType:lower()
  798.  
  799.     return newNotif
  800. end
  801.  
  802. function Notification:changeHeading(newHeading: string): nil
  803.     coroutine.wrap(function()
  804.         if not self.Instance or not self.Instance:FindFirstChild("templateFrame") then return end
  805.         self.Instance.templateFrame.informationFrame.headingText.Text = newHeading
  806.     end)()
  807. end
  808.  
  809. function Notification:changeBody(newBody: string): nil
  810.     coroutine.wrap(function()
  811.         if not self.Instance or not self.Instance:FindFirstChild("templateFrame") then return end
  812.         self.Instance.templateFrame.informationFrame.bodyText.Text = newBody
  813.     end)()
  814. end
  815.  
  816. function Notification:deleteTimeout(waitTime: number): nil
  817.     coroutine.wrap(function()
  818.         if not self.Instance or not self.Instance:FindFirstChild("templateFrame") then return end
  819.         local closeTween = ts:Create(self.Instance.templateFrame, TweenInfo.new(.25), {Position = UDim2.new(1,0,0,0)})
  820.         waitTime = waitTime or 3
  821.         task.wait(waitTime)
  822.         if not self.Instance or not self.Instance:FindFirstChild("templateFrame") then return end
  823.         closeTween:Play()
  824.         closeTween.Completed:Wait()
  825.         if self.Instance then return end
  826.         self.Instance:Destroy()
  827.     end)()
  828. end
  829.  
  830. function Notification:delete()
  831.     coroutine.wrap(function()
  832.         if not self.Instance or not self.Instance:FindFirstChild("templateFrame") then return end
  833.         local closeTween = ts:Create(self.Instance.templateFrame, TweenInfo.new(.25), {Position = UDim2.new(1,0,0,0)})
  834.         closeTween:Play()
  835.         closeTween.Completed:Wait()
  836.         if not self.Instance then return end
  837.         self.Instance:Destroy()
  838.     end)()
  839. end
  840.  
  841. function Notification:changeColor(primary: Color3, secondary: Color3, textColor: Color3): nil
  842.     coroutine.wrap(function()
  843.         if not self.Instance or not self.Instance:FindFirstChild("templateFrame") then return end
  844.         local templateFrame = self.Instance.templateFrame
  845.        
  846.         if primary then
  847.             templateFrame.BackgroundColor3 = primary
  848.             templateFrame.cornerHidingFrame.BackgroundColor3 = primary
  849.             templateFrame.severityFrame.hideSeverityCornerFrame.BackgroundColor3 = primary
  850.         end
  851.  
  852.         if secondary then
  853.             templateFrame.severityFrame.BackgroundColor3 = secondary
  854.             templateFrame.closeButton.ImageColor3 = secondary
  855.            
  856.             if self.Type ~= "message" then
  857.                 templateFrame.image.ImageColor3 = secondary
  858.             end
  859.         end
  860.  
  861.         if textColor then
  862.             templateFrame.informationFrame.headingText.TextColor3 = textColor
  863.             templateFrame.informationFrame.bodyText.TextColor3 = textColor
  864.         end
  865.     end)()
  866. end
  867.  
  868. scaleNotifHolderMaxNotifs()
  869. notifHolderListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(deleteNotifsOutsideFrame)
  870. return Notification
Add Comment
Please, Sign In to add comment