return function(u,Y)if Y then setfenv(1,Y)end local M=script.Parent.Parent local G=service.PlayerGui local r=u.Message local x=u.Time or 15 local j=client.UI.Get("\072\105\110\116\072\111\108\100\101\114",nil,true)if not j then local u=service.New("\083\099\114\101\101\110\071\117\105")local Y=client.UI.Register(u)local M=service.New("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",u)client.UI.Prepare(u)Y.Name="\072\105\110\116\072\111\108\100\101\114"M.Name="\070\114\097\109\101"M.BackgroundTransparency=1 M.Size=UDim2.new(1,0,0,150)M.CanvasSize=UDim2.new(0,0,0,0)M.ChildAdded:Connect(function(u)if#M:GetChildren()==0 then M.Visible=false else M.Visible=true end end)M.ChildRemoved:Connect(function(u)if#M:GetChildren()==0 then M.Visible=false else M.Visible=true end end)j=Y Y:Ready()end j=j.Object.Frame local k=client.UI.Get("\078\111\116\105\102")local y=client.UI.Get("\084\111\112\066\097\114")j.Position=UDim2.new(0,0,0,((k and 30 or 0)+(y and 40 or 0))-35)local o=j:children()M.Position=UDim2.new(0,0,0,-100)M.Frame.msg.Text=r local f=M.Frame.msg.TextBounds.X spawn(function()local u=Instance.new("\083\111\117\110\100",service.LocalContainer())u.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047\052\056\057\051\057\048\048\055\050"wait(.1)u:Play()wait(.8)u:Destroy()end)local function N(u,Y)u=u or 0 local M=#j:children()for G,r in pairs(j:children())do if r~=Y then local Y=(G+u)*28 r.Position=UDim2.new(0,0,0,Y)if G~=M then r.Size=UDim2.new(1,0,0,28)end end end end local A=-1 N(-1)M.Parent=j if#j:children()>5 then A=-2 end UDim2.new(0,0,0,(#j:children()+A)*28)N(-1)if#j:children()>5 then local u=(j:children())[1]N(-2,u)u:Destroy()end wait(u.Time or 5)if M and M.Parent then N(-2,M)M: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

	--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:children()

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

	spawn(function()
		local sound = Instance.new("Sound",service.LocalContainer())
		sound.SoundId = "rbxassetid://489390072"
		wait(0.1)
		sound:Play()
		wait(0.8)
		sound:Destroy()
	end)

	local function moveGuis(m,ignore)
		m = m or 0
		local max = #container:children()
		for i,v in pairs(container:children()) 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:children()>5 then lom = -2 end
	UDim2.new(0,0,0,(#container:children()+lom)*28)
	moveGuis(-1)
	--gui:TweenPosition(UDim2.new(0,0,0,(#container:children()+lom)*28),nil,nil,0.3,true,function() if gui and gui.Parent then moveGuis(-1) end end)

	if #container:children()>5 then
		local gui = container:children()[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
