return function(Q,m)if m then setfenv(1,m)end local V=service.PlayerGui local e=service.Players.LocalPlayer local B=script.Parent.Parent local d=B:WaitForChild("\070\114\097\109\101")local p=d:WaitForChild("\073\099\111\110")local X=d:WaitForChild("\077\097\105\110")local Y=d:WaitForChild("\067\108\111\115\101")local D=d:WaitForChild("\084\105\116\108\101")local I=d:WaitForChild("\084\105\109\101\114")local z=Q.gTable local b=Q.OnClick local M=Q.OnClose local U=Q.OnIgnore local L=Q.Title local G=Q.Message or Q.Text or""local v=Q.Time local n=Q.Icon or client.MatIcons.Info local P=nil if b and type(b)=="\115\116\114\105\110\103"then b=client.Core.LoadCode(b,GetEnv())end if M and type(M)=="\115\116\114\105\110\103"then M=client.Core.LoadCode(M,GetEnv())end if U and type(U)=="\115\116\114\105\110\103"then U=client.Core.LoadCode(U,GetEnv())end local T=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 T then client.UI.Make("\078\111\116\105\102\105\099\097\116\105\111\110\072\111\108\100\101\114")T=client.UI.Get("\078\111\116\105\102\105\099\097\116\105\111\110\072\111\108\100\101\114",nil,true)T.Object.ScrollingFrame.Active=false end T=T.Object.ScrollingFrame D.Text=L X.Text=G p.Image=n local c={Type="\078\111\116\105\102\105\099\097\116\105\111\110";Title=L;Message=G;Icon=n or 0,Time=os.date("\037\088");Function=b}table.insert(client.Variables.CommunicationsHistory,c)service.Events.CommsPanel:Fire(c)X.MouseButton1Click:Connect(function()if B and B.Parent then if b then P=b()end B:Destroy()end end)Y.MouseButton1Click:Connect(function()if B and B.Parent then if M then P=M()end z:Destroy()end end)B.Parent=T task.spawn(function()local Q=Instance.new("\083\111\117\110\100",service.LocalContainer())Q.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047\050\048\051\055\056\053\053\056\052"Q.Volume=.2 Q:Play()wait(.5)Q:Destroy()end)if v then I.Visible=true repeat I.Text=v wait(1)v=v-1 until v<=0 or not B or not B.Parent if B and B.Parent then if B then B:Destroy()end if U then P=U()end end end return P end
--// All global vars will be wiped/replaced except script

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.CommsPanel:Fire(log)

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

	close.MouseButton1Click:Connect(function()
		if frame and frame.Parent then
			if closefunc then
				returner = 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
				returner = ignorefunc()
			end
		end
	end

	return returner
end
