return function(F,q)if q then setfenv(1,q)end local Z=script.Parent.Parent local s=service.PlayerGui local Q=F.Message local N=F.Time or 15 local t={Type="\072\105\110\116";Title="\072\105\110\116",Message=Q,Icon="\114\098\120\097\115\115\101\116\105\100\058\047\047\055\053\048\049\049\055\053\055\048\056",Time=os.date("\037\088"),Function=nil}table.insert(client.Variables.CommunicationsHistory,t)service.Events.CommsCenter:Fire(t)local T=client.UI.Get("\072\105\110\116\072\111\108\100\101\114",nil,true)if not T then local F=service.New("\083\099\114\101\101\110\071\117\105")local q=client.UI.Register(F)local Z=service.New("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",F)client.UI.Prepare(F)q.Name="\072\105\110\116\072\111\108\100\101\114"Z.Name="\070\114\097\109\101"Z.BackgroundTransparency=1 Z.Size=UDim2.new(1,0,0,150)Z.CanvasSize=UDim2.new(0,0,0,0)Z.ChildAdded:Connect(function(F)if#Z:GetChildren()==0 then Z.Visible=false else Z.Visible=true end end)Z.ChildRemoved:Connect(function(F)if#Z:GetChildren()==0 then Z.Visible=false else Z.Visible=true end end)T=q q:Ready()end T=T.Object.Frame local b=client.UI.Get("\078\111\116\105\102")local h=client.UI.Get("\084\111\112\066\097\114")T.Position=UDim2.new(0,0,0,((b and 30 or 0)+(h and 40 or 0))-35)local z=T:GetChildren()Z.Position=UDim2.new(0,0,0,-100)Z.Frame.msg.Text=Q local B=Z.Frame.msg.TextBounds.X local function W(F,q)F=F or 0 local Z=#T:GetChildren()for s,Q in pairs(T:GetChildren())do if Q~=q then local q=(s+F)*28 Q.Position=UDim2.new(0,0,0,q)if s~=Z then Q.Size=UDim2.new(1,0,0,28)end end end end local U=-1 W(-1)Z.Parent=T if#T:GetChildren()>5 then U=-2 end UDim2.new(0,0,0,(#T:GetChildren()+U)*28)W(-1)if#T:GetChildren()>5 then local F=(T:GetChildren())[1]W(-2,F)F:Destroy()end wait(F.Time or 5)if Z and Z.Parent then W(-2,Z)Z:Destroy()end end


return function(data, env)
	if env then
		setfenv(1, env)
	end
	local gui = script.Parent.Parent
	local playergui = service.PlayerGui
	local str = data.Message
	local time = data.Time or 15

	local log  = {
		Type = "Hint";
		Title = "Hint";
		Message = str;
		Icon = "rbxassetid://7501175708";
		Time = os.date("%X");
		Function = nil;
	}

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

	--client.UI.Make("HintHolder")
	local container = client.UI.Get("HintHolder",nil,true)
	if not container then
		local holder = service.New("ScreenGui")
		local hTable = client.UI.Register(holder)
		local frame = service.New("ScrollingFrame", holder)
		client.UI.Prepare(holder)
		hTable.Name = "HintHolder"
		frame.Name = "Frame"
		frame.BackgroundTransparency = 1
		frame.Size = UDim2.new(1, 0, 0,150)
		frame.CanvasSize = UDim2.new(0, 0, 0, 0)
		frame.ChildAdded:Connect(function(c)
			if #frame:GetChildren() == 0 then
				frame.Visible = false
			else
				frame.Visible = true
			end
		end)

		frame.ChildRemoved:Connect(function(c)
			if #frame:GetChildren() == 0 then
				frame.Visible = false
			else
				frame.Visible = true
			end
		end)

		container = hTable
		hTable:Ready()
	end
	container = container.Object.Frame

	--// First things first account for notif :)
	local notif = client.UI.Get("Notif")
	local topbar = client.UI.Get("TopBar")

	container.Position = UDim2.new(0,0,0,((notif and 30) or 0) + ((topbar and 40) or 0) - 35)

	local children = container:GetChildren()

	gui.Position = UDim2.new(0,0,0,-100)
	gui.Frame.msg.Text = str
	local bounds = gui.Frame.msg.TextBounds.X

	local function moveGuis(m,ignore)
		m = m or 0
		local max = #container:GetChildren()
		for i,v in pairs(container:GetChildren()) do
			if v~=ignore then
				local y = (i+m)*28
				v.Position = UDim2.new(0,0,0,y)
				if i~=max then v.Size = UDim2.new(1,0,0,28) end
			end
		end
	end

	local lom = -1
	moveGuis(-1)
	gui.Parent = container
	if #container:GetChildren()>5 then lom = -2 end
	UDim2.new(0,0,0,(#container:GetChildren()+lom)*28)
	moveGuis(-1)
	--gui:TweenPosition(UDim2.new(0,0,0,(#container:GetChildren()+lom)*28),nil,nil,0.3,true,function() if gui and gui.Parent then moveGuis(-1) end end)

	if #container:GetChildren()>5 then
		local gui = container:GetChildren()[1]
		moveGuis(-2,gui)
		gui:Destroy()
		--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
	end

	wait(data.Time or 5)

	if gui and gui.Parent then
		moveGuis(-2,gui)
		gui:Destroy()
		--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
	end
end
