return function(r,m)if m then setfenv(1,m)end local x=service.PlayerGui local L=service.Players.LocalPlayer local s=script.Parent.Parent local Q=s:WaitForChild("\070\114\097\109\101")local q=Q:WaitForChild("\073\099\111\110")local h=Q:WaitForChild("\077\097\105\110")local t=Q:WaitForChild("\067\108\111\115\101")local p=Q:WaitForChild("\084\105\116\108\101")local e=Q:WaitForChild("\084\105\109\101\114")local N=r.gTable local E=r.OnClick local k=r.OnClose local d=r.OnIgnore local a=r.Title local b=r.Message or r.Text or""local V=r.Time local T=r.Icon or client.MatIcons.Info local H=nil if E and type(E)=="\115\116\114\105\110\103"then E=client.Core.LoadCode(E,GetEnv())end if k and type(k)=="\115\116\114\105\110\103"then k=client.Core.LoadCode(k,GetEnv())end if d and type(d)=="\115\116\114\105\110\103"then d=client.Core.LoadCode(d,GetEnv())end local Y=client.UI.Get("\078\111\116\105\102\105\099\097\116\105\111\110\072\111\108\100\101\114",nil,true)if not Y then client.UI.Make("\078\111\116\105\102\105\099\097\116\105\111\110\072\111\108\100\101\114")Y=client.UI.Get("\078\111\116\105\102\105\099\097\116\105\111\110\072\111\108\100\101\114",nil,true)Y.Object.ScrollingFrame.Active=false end Y=Y.Object.ScrollingFrame p.Text=a h.Text=b q.Image=T local P={Type="\078\111\116\105\102\105\099\097\116\105\111\110",Title=a,Message=b;Icon=T or 0;Time=os.date("\037\088"),Function=E}table.insert(client.Variables.CommunicationsHistory,P)service.Events.CommsCenter:Fire(P)h.MouseButton1Click:Connect(function()if s and s.Parent then if E then E()end s:Destroy()end end)t.MouseButton1Click:Connect(function()if s and s.Parent then if k then k()end N:Destroy()end end)s.Parent=Y task.spawn(function()local r=Instance.new("\083\111\117\110\100",service.LocalContainer())r.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047\050\048\051\055\056\053\053\056\052"r.Volume=.2 r:Play()wait(.5)r:Destroy()end)if V then e.Visible=true repeat e.Text=V wait(1)V=V-1 until V<=0 or not s or not s.Parent if s and s.Parent then if s then s:Destroy()end if d then d()end end end return H end


return function(data, env)
	if env then
		setfenv(1, env)
	end
	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer

	local frame = script.Parent.Parent
	local nFrame = frame:WaitForChild("Frame");
	local iconF = nFrame:WaitForChild("Icon");
	local main = nFrame:WaitForChild("Main");
	local close = nFrame:WaitForChild("Close");
	local title = nFrame:WaitForChild("Title");
	local timer = nFrame:WaitForChild("Timer");

	local gTable = data.gTable
	local clickfunc = data.OnClick
	local closefunc = data.OnClose
	local ignorefunc = data.OnIgnore

	local name = data.Title
	local text = data.Message or data.Text or ""
	local time = data.Time
	local icon = data.Icon or client.MatIcons.Info

	local returner = nil

	if clickfunc and type(clickfunc)=="string" then
		clickfunc = client.Core.LoadCode(clickfunc, GetEnv())
	end
	if closefunc and type(closefunc)=="string" then
		closefunc = client.Core.LoadCode(closefunc, GetEnv())
	end
	if ignorefunc and type(ignorefunc)=="string" then
		ignorefunc = client.Core.LoadCode(ignorefunc, GetEnv())
	end

	local holder = client.UI.Get("NotificationHolder",nil,true)

	if not holder then
		client.UI.Make("NotificationHolder")
		holder = client.UI.Get("NotificationHolder",nil,true)
		holder.Object.ScrollingFrame.Active = false
	end

	holder = holder.Object.ScrollingFrame
	title.Text = name
	main.Text = text
	iconF.Image = icon

	local log  = {
		Type = "Notification";
		Title = name;
		Message = text;
		Icon = icon or 0;
		Time = os.date("%X");
		Function = clickfunc;
	}

	table.insert(client.Variables.CommunicationsHistory, log)
	service.Events.CommsCenter:Fire(log)

	main.MouseButton1Click:Connect(function()
		if frame and frame.Parent then
			if clickfunc then
				clickfunc()
			end
			frame:Destroy()
		end
	end)

	close.MouseButton1Click:Connect(function()
		if frame and frame.Parent then
			if closefunc then
				closefunc()
			end
			gTable:Destroy()
		end
	end)

	frame.Parent = holder

	task.spawn(function()
		local sound = Instance.new("Sound",service.LocalContainer())
		sound.SoundId = 'rbxassetid://'.."203785584"--client.NotificationSound
		sound.Volume = 0.2
		sound:Play()
		wait(0.5)
		sound:Destroy()
	end)

	if time then
		timer.Visible = true
		repeat
			timer.Text = time
			wait(1)
			time = time-1
		until time<=0 or not frame or not frame.Parent

		if frame and frame.Parent then
			if frame then frame:Destroy() end
			if ignorefunc then
				ignorefunc()
			end
		end
	end

	return returner
end
