createLabel()
local Title,canRefresh,canSearch,dataTable = Data[1],Data[2],Data[3],Data[4]
local List = baseClip:WaitForChild('List Template')
local listClone = List:Clone()
listClone.Name = "List Clone"
local scrollingFrame = listClone:WaitForChild('ScrollingFrame')
local Template = scrollingFrame:WaitForChild('Template')
Template.Visible = false
local Controls = listClone:WaitForChild('Controls')
local exitButton = Controls:WaitForChild('Exit')
local searchButton = Controls:WaitForChild('Search')
local refreshButton = Controls:WaitForChild('Refresh')
local Decoration = Controls:WaitForChild('Decoration')
local searchBar = Decoration:WaitForChild('Search')
local searchBox = searchBar:WaitForChild('TextBox')
local listTitle = Decoration:WaitForChild('Title')
listTitle.Text = Title
if canSearch and not canRefresh then
refreshButton.Visible = false
Decoration.Size = UDim2.new(1.277, -90,0, 30)
elseif not canSearch and canRefresh then
searchButton.Visible = false
refreshButton.Position = UDim2.new(1.277, -90,0, 30)
Decoration.Size = UDim2.new(1.277, -90,0, 30)
elseif not canSearch and not canRefresh then
Decoration.Size = UDim2.new(1.277, -90,0, 30)
searchButton.Visible = false
refreshButton.Visible = false
end
listClone.Position = UDim2.new(0,-listClone.Size.X.Offset-5,0.5,-150)
listClone.Parent = baseClip
listClone.Visible = true
exitButton.MouseButton1Click:connect(function()
spawn(function()
for a,b in pairs(scrollingFrame:GetChildren()) do
TweenTextTransparency(b,0,1,0.5*0.65)
wait()
end
end)
for a,b in pairs(Stacks.Frames) do
if b == listClone then
table.remove(Stacks.Frames,a)
end
end
figureFrames(Stacks.Frames)
listClone:TweenPosition(UDim2.new(listClone.Position.X.Scale,listClone.Position.X.Offset,1,5),"Out","Quint",0.3,true)
repeat wait() until listClone.Position == UDim2.new(listClone.Position.X.Scale,listClone.Position.X.Offset,1,5)
listClone:Destroy()
end)
local function tableTest(Table)
for a,b in next,Table do
if type(b) == "table" then
return "Table"
elseif type(b) == "string" or type(b) == "number" or type(b) == "boolean" then
return "Other"
end
end
end
-- local function Reverse(Table)
-- local Len = #Table
-- local newTab = {}
-- for i,v in pairs(Table) do
-- newTab[Len] = v
-- Len = Len - 1
-- end
-- return newTab
-- end
local function queryTable(Table,Data)
local tempTable = {}
ypcall(function()
for _,v in pairs(Table) do
if string.lower(v):match(string.lower(Data)) then
table.insert(tempTable,v)
end
end
end)
return tempTable
end
local Down = 0
local stopLoops = {}
local lastLoop = nil
local loopManager = {}
loopManager.__index = loopManager
function loopManager.new() return setmetatable({}, loopManager) end
function loopManager:Break()
stopLoops[self] = true
end
function loopManager:NewLoop(Table)
for a,b in pairs(scrollingFrame:GetChildren()) do
if b.Name ~= 'Template' then
b:Destroy()
end
end
local tempDown = 0
if #Table >= 1 then
for a,b in pairs(Table) do
if stopLoops[self] then stopLoops[self] = nil break end
local dataText = Template:clone()
if Title == "Commands" and tableTest(Table) == "Table" then
dataText.Text = b[2]..b[5][1]
dataText.Name = b[5][1]
elseif Title == "Donor Data" and tableTest(Table) == "Table" then
dataText.Text = b[1]
dataText.Name = b[1]
else
dataText.Text = b
dataText.Name = b
end
if tempDown == 0 then
dataText.Position = UDim2.new(0,10,0,20*tempDown+0*tempDown)
tempDown = 1
else
dataText.Position = UDim2.new(0,10,0,20*tempDown+0*tempDown)
tempDown = tempDown+1
end
scrollingFrame.CanvasSize = UDim2.new(0,0,0,20*tempDown+0*tempDown)
dataText.Parent = scrollingFrame
dataText.TextTransparency = 1
dataText.Visible = true
TweenTextTransparency(dataText,1,0,0.5*0.65)
Services.runService.RenderStepped:wait()
if tempDown >= 1500 then
dataText.Name = "Displaying 1500 of "..#Table..' results.'
dataText.Text = "Displaying 1500 of "..#Table..' results.'
break
end
end
else
scrollingFrame.CanvasSize = UDim2.new(0,0,0,20*Down+0*Down)
local dataText = Template:clone()
dataText.Text = 'No Data'
dataText.Parent = scrollingFrame
dataText.Name = 'No Data'
dataText.Visible = true
TweenTextTransparency(dataText,1,0,0.5*0.65)
end
end
scrollingFrame.ChildAdded:connect(function(Obj)
if Obj:IsA('TextLabel') then
Obj.MouseEnter:connect(function()
Obj.MouseMoved:connect(function(X,Y)
if Title == 'Commands' then
local Matched = false
for a,b in pairs(dataTable) do
if Obj.Name == b[5][1] then
Matched = true
mouseLabel.Text = b[2]..b[5][1]..' '..b[5][2]..'\n'..b[5][3]
end
end
if not Matched then
mouseLabel.Text = Obj.Text
end
elseif Title == "Donor Data" then
local Matched = false
for a,b in pairs(dataTable) do
if Obj.Name == b[1] then
Matched = true
mouseLabel.Text = b[1]..'\n'..b[2]
end
end
if not Matched then
mouseLabel.Text = Obj.Text
end
else
mouseLabel.Text = Obj.Text
end
local XB,YB = mouseLabel.TextBounds.X, mouseLabel.TextBounds.Y
mouseLabel.BorderSizePixel = 1
mouseLabel.Size = UDim2.new(0,XB+10,0,YB+10)
local mouseOffset
if mouseLabel.AbsoluteSize.Y <= 28 then
mouseOffset = ((mouseLabel.AbsoluteSize.Y*2)-5)
else
mouseOffset = 60
end
if X-(mouseLabel.AbsoluteSize.X) >= 0 then
mouseLabel.Position = UDim2.new(0, X-(mouseLabel.AbsoluteSize.X), 0, Y-(mouseLabel.AbsoluteSize.Y/2)-mouseOffset)
elseif X-(mouseLabel.AbsoluteSize.X) <= 0 then
mouseLabel.Position = UDim2.new(0, X, 0, Y-(mouseLabel.AbsoluteSize.Y/2)-mouseOffset)
end
end)
end)
Obj.MouseLeave:connect(function()
mouseLabel.Text = ''
mouseLabel.BorderSizePixel = 0
mouseLabel.Size = UDim2.new(0,0,0,0)
end)
end
end)
searchButton.MouseButton1Click:connect(function()
if listTitle.Visible then
listTitle.Visible = false
searchBar.Position = UDim2.new(0,0,-1,0)
searchBar.Visible = true
searchBar:TweenPosition(UDim2.new(0,0,0,0),'Out','Quint',0.3,true)
else
listTitle.Visible = true
searchBar:TweenPosition(UDim2.new(0,0,1,0),'Out','Quint',0.3,true)
searchBar.Visible = false
listTitle.Visible = true
end
searchBox.Text = "Search.."
end)
local refreshDebounce = false
refreshButton.MouseButton1Click:connect(function()
if not canRefresh then return end
if not refreshDebounce then
refreshDebounce = true
-- local Reply = essentialsFunction:InvokeServer(clientConfig.Key,'Refresh',Title)
local Reply = invokeServer('Refresh',Title)
if Reply then
dataTable = Reply
if lastLoop then
lastLoop:Break()
end
local newLoop = loopManager.new()
lastLoop = newLoop
newLoop:NewLoop(dataTable)
end
wait(0.15)
refreshDebounce = false
end
end)
searchBox.Changed:connect(function(Prop)
if Prop == "Text" then
if searchBox.Text ~= '' and searchBox.Text ~= "Search.." then
if lastLoop then
lastLoop:Break()
end
local queriedTable
if tableTest(dataTable) == "Table" then
local tempTable = {}
for a,b in next,dataTable do
table.insert(tempTable,b[1])
end
queriedTable = queryTable(tempTable,searchBox.Text)
else
queriedTable = queryTable(dataTable,searchBox.Text)
end
local newLoop = loopManager.new()
lastLoop = newLoop
newLoop:NewLoop(queriedTable)
else
if lastLoop then
lastLoop:Break()
end
local newLoop = loopManager.new()
lastLoop = newLoop
newLoop:NewLoop(dataTable)
end
end
end)
spawn(function()
local newLoop = loopManager.new()
lastLoop = newLoop
newLoop:NewLoop(dataTable)
end)
table.insert(Stacks.Frames,listClone)
figureFrames(Stacks.Frames)```