return function(g,R)if R then setfenv(1,R)end local Z=script.Parent.Parent local j=Z.Frame local O=j.Frame local w=O.Message local h=O.Title local U=g.gIndex local i=g.gTable local k=g.Title local Y=g.Message local p=g.Scroll local P=g.Time local n=false if not g.Message or not g.Title then i:Destroy()end h.Text=k w.Text=Y h.TextTransparency=1 w.TextTransparency=1 h.TextStrokeTransparency=1 w.TextStrokeTransparency=1 j.BackgroundTransparency=1 local A=10 local m=10 local S=.1 local u=.5 local N=j.BackgroundTransparency local f=m/A local a=N/A local E=.1 local v=.1 local function V()i:Ready()for g=1,A,1 do if w.TextTransparency>S then w.TextTransparency=w.TextTransparency-E h.TextTransparency=h.TextTransparency-E end if w.TextStrokeTransparency>u then w.TextStrokeTransparency=w.TextStrokeTransparency-v h.TextStrokeTransparency=h.TextStrokeTransparency-v end if j.BackgroundTransparency>N then j.BackgroundTransparency=j.BackgroundTransparency-a end service.Wait("\083\116\101\112\112\101\100")end end local function l()if not n then n=true for g=1,A,1 do if w.TextTransparency<1 then w.TextTransparency=w.TextTransparency+E h.TextTransparency=h.TextTransparency+E end if w.TextStrokeTransparency<1 then w.TextStrokeTransparency=w.TextStrokeTransparency+v h.TextStrokeTransparency=h.TextStrokeTransparency+v end if j.BackgroundTransparency<1 then j.BackgroundTransparency=j.BackgroundTransparency+a O.BackgroundTransparency=j.BackgroundTransparency end service.Wait("\083\116\101\112\112\101\100")end;(service.UnWrap(Z)):Destroy()end end i.CustomDestroy=function()l()end V()if not P then local g,R=Y:gsub(" ","")R=math.clamp(R/2,4,11)+1 wait(R)else wait(P)end if not n then l()end end
--// All global vars will be wiped/replaced except script

return function(data, env)
	if env then
		setfenv(1, env)
	end

	local gui = script.Parent.Parent --client.UI.Prepare(script.Parent.Parent)
	local frame = gui.Frame
	local frame2 = frame.Frame
	local msg = frame2.Message
	local ttl = frame2.Title

	local gIndex = data.gIndex
	local gTable = data.gTable

	local title = data.Title
	local message = data.Message
	local scroll = data.Scroll
	local tim = data.Time

	local gone = false

	if not data.Message or not data.Title then
		gTable:Destroy()
	end

	ttl.Text = title
	msg.Text = message
	ttl.TextTransparency = 1
	msg.TextTransparency = 1
	ttl.TextStrokeTransparency = 1
	msg.TextStrokeTransparency = 1
	frame.BackgroundTransparency = 1

	local fadeSteps = 10
	local blurSize = 10
	local textFade = 0.1
	local strokeFade = 0.5
	local frameFade = frame.BackgroundTransparency

	local blurStep = blurSize / fadeSteps
	local frameStep = frameFade / fadeSteps
	local textStep = 0.1
	local strokeStep = 0.1

	local function fadeIn()
		gTable:Ready()
		for i = 1, fadeSteps do
			if msg.TextTransparency > textFade then
				msg.TextTransparency = msg.TextTransparency - textStep
				ttl.TextTransparency = ttl.TextTransparency - textStep
			end
			if msg.TextStrokeTransparency > strokeFade then
				msg.TextStrokeTransparency = msg.TextStrokeTransparency - strokeStep
				ttl.TextStrokeTransparency = ttl.TextStrokeTransparency - strokeStep
			end
			if frame.BackgroundTransparency > frameFade then
				frame.BackgroundTransparency = frame.BackgroundTransparency - frameStep
				--frame2.BackgroundTransparency = frame.BackgroundTransparency
			end
			service.Wait("Stepped")
		end
	end

	local function fadeOut()
		if not gone then
			gone = true
			for i = 1, fadeSteps do
				if msg.TextTransparency < 1 then
					msg.TextTransparency = msg.TextTransparency + textStep
					ttl.TextTransparency = ttl.TextTransparency + textStep
				end
				if msg.TextStrokeTransparency < 1 then
					msg.TextStrokeTransparency = msg.TextStrokeTransparency + strokeStep
					ttl.TextStrokeTransparency = ttl.TextStrokeTransparency + strokeStep
				end
				if frame.BackgroundTransparency < 1 then
					frame.BackgroundTransparency = frame.BackgroundTransparency + frameStep
					frame2.BackgroundTransparency = frame.BackgroundTransparency
				end
				service.Wait("Stepped")
			end
			service.UnWrap(gui):Destroy()
		end
	end

	gTable.CustomDestroy = function()
		fadeOut()
	end

	fadeIn()
	if not tim then
		local _, time = message:gsub(" ", "")
		time = math.clamp(time / 2, 4, 11) + 1
		wait(time)
	else
		wait(tim)
	end
	if not gone then
		fadeOut()
	end
end
