return function(g,e)if e then setfenv(1,e)end local V=script.Parent.Parent local y=service.PlayerGui local b=g.Message local p=g.Time or 15 local M={Type="\072\105\110\116";Title="\072\105\110\116",Message=b,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,M)service.Events.CommsPanel:Fire(M)local E=client.UI.Get("\072\105\110\116\072\111\108\100\101\114",nil,true)if not E then local g=service.New("\083\099\114\101\101\110\071\117\105")g.IgnoreGuiInset=not client.Variables.TopBarShift g.ClipToDeviceSafeArea=true local e=client.UI.Register(g)local V=service.New("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",g)client.UI.Prepare(g)e.Name="\072\105\110\116\072\111\108\100\101\114"V.Name="\070\114\097\109\101"V.BackgroundTransparency=1 V.Size=UDim2.new(1,0,0,150)V.CanvasSize=UDim2.new(0,0,0,0)V.ChildAdded:Connect(function(g)if#V:GetChildren()==0 then V.Visible=false else V.Visible=true end end)V.ChildRemoved:Connect(function(g)if#V:GetChildren()==0 then V.Visible=false else V.Visible=true end end)E=e e:Ready()end E=E.Object.Frame local u=client.UI.Get("\078\111\116\105\102")if E:IsA("\083\099\114\101\101\110\071\117\105")then E.IgnoreGuiInset,E.ClipToDeviceSafeArea=not client.Variables.TopBarShift,true end E.Position=UDim2.new(0,0,0,u and 30 or 0)local I=E:GetChildren()V.Position=UDim2.new(0,0,0,-100)V.Frame.msg.Text=b local B=V.Frame.msg.TextBounds.X local function k(g,e)g=g or 0 local V=#E:GetChildren()for y,b in pairs(E:GetChildren())do if b~=e then local e=(y+g)*28 b.Position=UDim2.new(0,0,0,e)if y~=V then b.Size=UDim2.new(1,0,0,28)end end end end local h=-1 k(-1)V.Parent=E if#E:GetChildren()>5 then h=-2 end UDim2.new(0,0,0,(#E:GetChildren()+h)*28)k(-1)if#E:GetChildren()>5 then local g=(E:GetChildren())[1]k(-2,g)g:Destroy()end wait(g.Time or 5)if V and V.Parent then k(-2,V)V:Destroy()end end
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name

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

	--client.UI.Make("HintHolder")
	local container = client.UI.Get("HintHolder", nil, true)
	if not container then
		local holder = service.New("ScreenGui")
		holder.IgnoreGuiInset = not client.Variables.TopBarShift
		holder.ClipToDeviceSafeArea = true

		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")

	if container:IsA("ScreenGui") then
		container.IgnoreGuiInset, container.ClipToDeviceSafeArea = not client.Variables.TopBarShift, true
	end

	container.Position = UDim2.new(0, 0, 0, (notif and 30 or 0))

	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
