function module.ReplicateEffect(M,l,G)main.signals.ReplicateEffect:FireServer(l,G)end function module.UpdateIconVisiblity(l)local G=main.pdata.Rank>=main.settings.RankRequiredToViewIcon and 0 or 1;(main.tweenService:Create(main.gui.CustomTopBar.ImageButton,TweenInfo.new(1),{ImageTransparency=G})):Play()end function module.DeactivateCommand(G,l)main.commandsAllowedToUse[l]=nil main.commandsActive[l]=nil if not main.commandsToDisableCompletely[l]then local G=main.gui:FindFirstChild("\067\111\109\109\097\110\100\077\101\110\117"..l);(main:GetModule("\099\102")):DestroyCommandMenuFrame(G)end end function module.EndCommand(G,l)main.commandsActive[l]=nil;(main:GetModule("\099\102")):UpdateCommandMenu(l)end function module.ActivateClientCommand(M,l,G)if main.commandsAllowedToUse[l]and not main.commandsActive[l]then if not(G and(G.DontForceActivate and main.gui:FindFirstChild("\067\111\109\109\097\110\100\077\101\110\117"..l)))then main.commandsActive[l]=true spawn(function()(main:GetModule("\099\102")):UpdateCommandMenu(l)local G=(main:GetModule("\067\108\105\101\110\116\067\111\109\109\097\110\100\115"))[l]if G then local l=G.Activate if l then l(G)end end main.commandsActive[l]=nil end)end end end function module.GetCF(M,l,G)local C=l.CFrame local s=CFrame.new(C.p)local k,w,W=(workspace.CurrentCamera.CFrame-workspace.CurrentCamera.CFrame.p):toEulerAnglesXYZ()return s*CFrame.Angles(G and W or k,w,W)end function module.GetNextMovement(M,l,G)local C=Vector3.new()local s={Left=Vector3.new(-1,0,0),Right=Vector3.new(1,0,0);Forwards=Vector3.new(0,0,-1);Backwards=Vector3.new(0,0,1);Up=Vector3.new(0,1,0),Down=Vector3.new(0,-1,0)}if main.device=="\067\111\109\112\117\116\101\114"then for l,G in pairs(main.movementKeysPressed)do local M=s[G]if M then C=C+M end end else local l=(main:GetModule("\099\102")):GetHumanoid()local G=(main:GetModule("\099\102")):GetHRP()if l then local M=l.MoveDirection for l,s in pairs(s)do local k=false if l=="\070\111\114\119\097\114\100\115"or l=="\066\097\099\107\119\097\114\100\115"then k=true end local w=(module:GetCF(G,true)*CFrame.new(s)-G.CFrame.p).p if(w-M).magnitude<=1.05 and M~=Vector3.new(0,0,0)then C=C+s end end end end return CFrame.new((C*G)*l),C end function module.GetAssetImage(G,l)return"\104\116\116\112\115\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116-\116\104\117\109\098\110\097\105\108\047\105\109\097\103\101\063\097\115\115\101\116\073\100\061"..(l.."\038\119\105\100\116\104\061\052\050\048\038\104\101\105\103\104\116\061\052\050\048\038\102\111\114\109\097\116\061\112\110\103")end function module.GetUserImage(G,l)return"\104\116\116\112\115\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\104\101\097\100\115\104\111\116-\116\104\117\109\098\110\097\105\108\047\105\109\097\103\101\063\117\115\101\114\073\100\061"..(l.."\038\119\105\100\116\104\061\052\050\048\038\104\101\105\103\104\116\061\052\050\048\038\102\111\114\109\097\116\061\112\110\103")end function module.ShowPermRankedUser(G,l)local M,C,s=l[1],l[2],l[3]permRank.PlrName.Text=M permRank.PlrImage.Image=module:GetUserImage(C)permRank.RankedBy.TextLabel.Text=(main:GetModule("\099\102")):GetName(s);(main:GetModule("\099\102")):ShowWarning("\080\101\114\109\082\097\110\107")end function module.ShowBannedUser(G,l)local M,C,s,k=l[1],l[2],l[3],l[4]local w=unBan.Reason.TextLabel unBan.PlrName.Text=M unBan.PlrImage.Image=module:GetUserImage(C)unBan.BannedBy.TextLabel.Text=(main:GetModule("\099\102")):GetName(k)w.Text="\'"..(s.."\'")if w.Text==""or w.Text==" "then w.Text="\069\109\112\116\121"w.Font=Enum.Font.SourceSansItalic else w.Font=Enum.Font.SourceSans end;(main:GetModule("\099\102")):ShowWarning("\085\110\066\097\110")end function module.ShowWarning(G,l)for G,M in pairs(main.warnings:GetChildren())do if M.Name==l then M.Visible=true main.warnings.Visible=true else M.Visible=false end end end function module.SetCameraSubject(G,l)local M=(main:GetModule("\099\102")):GetFace()if M then local G=M.Transparency main.camera.CameraSubject=l M.Transparency=G end end function module.DestroyCommandMenuFrame(G,l)if l then for G,M in pairs(main.commandMenus)do if M==l then table.remove(main.commandMenus,G)end end l:Destroy()end end function module.UpdateCommandMenu(M,l,G)if G==nil then G=main.gui:FindFirstChild("\067\111\109\109\097\110\100\077\101\110\117"..l)end if G then local M=G.MainFrame local C=M:FindFirstChild("\083\116\097\116\117\115")if C then if main.commandsToDisableCompletely[l]and main.commandsAllowedToUse[l]or main.commandsActive[l]then M.Status.TextLabel.Text="\079\110"M.Status.TextLabel.TextColor3=Color3.fromRGB(0,225,0)M.ChangeStatus.TextLabel.Text="\068\073\083\065\066\076\069"else M.Status.TextLabel.Text="\079\102\102"M.Status.TextLabel.TextColor3=Color3.fromRGB(255,0,0)M.ChangeStatus.TextLabel.Text="\069\078\065\066\076\069"end end end end function module.CreateNewCommandMenu(s,l,G,M,C)local k={4,5,8;11,12}local w={4}local W={5;6,7,9;12}M=tonumber(M)local H=(main:GetModule("\099\102")):FindValue(k,M)local o=(main:GetModule("\099\102")):FindValue(w,M)local L=(main:GetModule("\099\102")):FindValue(W,M)local N="\067\111\109\109\097\110\100\077\101\110\117"..l if o then N="\067\111\109\109\097\110\100\077\101\110\117"..(l..pmId)pmId=pmId+1 end local n=main.gui:FindFirstChild(N)if n and L then n:Destroy()n=nil end if not n then local s=menuTemplates["\084\101\109\112\108\097\116\101"..M]local k=s.MainFrame n=s:Clone()n.Name=N local w=n.DragBar local W=n.MainFrame local o=string.upper(string.gsub(l,"\037\117",function(l)return" "..l end))w.Title.Text=o;(main:GetModule("\073\110\112\117\116\072\097\110\100\108\101\114")):MakeFrameDraggable(n)w.Close.MouseButton1Down:Connect(function()if H then module:DestroyCommandMenuFrame(n)else n.Visible=false end end)local L=W.Position.Y.Scale local b=-((1-w.Size.Y.Scale)-L)local c=w:FindFirstChild("\077\105\110\105\109\105\115\101")if c then c.MouseButton1Down:Connect(function()if c.TextLabel.Text=="-"then(main.tweenService:Create(W,TweenInfo.new(.5),{Position=UDim2.new(0,0,b,-1)})):Play()c.TextLabel.Text="\043"else(main.tweenService:Create(W,TweenInfo.new(.5),{Position=UDim2.new(0,0,L,0)})):Play()c.TextLabel.Text="-"end end)end local function U(l,G,M)l.CanvasSize=UDim2.new(0,0,0,(G.AbsolutePosition.Y-M.AbsolutePosition.Y)+G.AbsoluteSize.Y)end local function q(l,G,M)local C,s,k,w,W=M[1],M[2],M[3],M[4],M[5]local H=l:FindFirstChild(G)if not H then G=C[l.Name]end if l.Name=="\065\067 \083\101\114\118\101\114"and(G=="\065\108\108"and main.pdata.Rank<main.commandRanks.globalvote)then(main:GetModule("\078\111\116\105\099\101\115")):Notice("\069\114\114\111\114",main.hdAdminCoreName,"\077\117\115\116 \098\101 \'"..((main:GetModule("\099\102")):GetRankName(main.commandRanks.globalvote).."\' \116\111 \117\115\101 \059\103\108\111\098\097\108\086\111\116\101"))else for M,C in pairs(l:GetChildren())do if C:IsA("\084\101\120\116\066\117\116\116\111\110")then s(C,G,l)end end if w and W then U(k,w,W)end end end local function j(l,G,M,C,s,k,w)local W=false M.Focused:Connect(function()W=true end)M.FocusLost:Connect(function()wait()W=false end)for l,M in pairs(l)do local k=G[l]for l,G in pairs(k:GetChildren())do if G:IsA("\084\101\120\116\066\117\116\116\111\110")then G.MouseButton1Down:Connect(function()if not W then q(k,G.Name,C)end end)end end s(k)end if k then for l,G in pairs(k:GetChildren())do local M=G:FindFirstChild("\084\101\120\116\066\111\120")if M then local l=M.Text M.Focused:Connect(function()W=true end)M.FocusLost:connect(function(C)local s=tonumber(M.Text)if s then if s<0 then s=0 elseif G.Name=="\077\105\110\117\116\101\115"and s>60 then s=60 elseif G.Name=="\072\111\117\114\115"and s>24 then s=24 elseif G.Name=="\068\097\121\115"and s>100000 then s=100000 end l=s end M.Text=l wait()W=false end)end end end if w then local l=string.lower(w)local G=w for M,C in pairs(main.qualifiers)do if C==l then G=C break end end if not G then for M,C in pairs(main.players:GetChildren())do if string.sub(string.lower(C.Name),1,#l)==l then G=C.Name break end end end M.Text=G or""end end local function e(l,G,M,C,s,k)local w=l.FinalResult local W=w.Frame local H=W.Example local o=W.Loading local L=W.Broadcast w.Visible=false W.CloseX.MouseButton1Down:Connect(function()w.Visible=false end)L.MouseButton1Down:Connect(function()o.Visible=true L.Visible=false k()module:DestroyCommandMenuFrame(l)end)G.MouseButton1Down:Connect(function()M.Visible=true G.Visible=false local l=C()if type(l)=="\116\097\098\108\101"then s(l)else local G=tostring(l)or"\069\114\114\111\114"M.TextLabel.Text=G wait(1)M.TextLabel.Text="\076\111\097\100\105\110\103\046\046\046"end M.Visible=false G.Visible=true end)end local function R(l,G)local M=l.AnswerTemplate M.Visible=false l.Question.TextLabel.Text=G.Question for l,G in pairs(l:GetChildren())do if G:IsA("\084\101\120\116\066\117\116\116\111\110")and G~=M then G:Destroy()end end for C,s in pairs(G.Answers)do local k=M:Clone()k.Visible=true k.Name="\065\110\115\119\101\114"..C k.TextLabel.Text=C..("\046 "..s)k.BackgroundColor3=module:GetLabelBackgroundColor(C)local w=k.Fade local W=false if G.Remote then k.MouseButton1Up:Connect(function()l.Parent.Parent.Visible=false pcall(function()G.Remote:FireServer(C)end)end)end k.InputBegan:Connect(function(l)(main.tweenService:Create(w,TweenInfo.new(.2),{BackgroundTransparency=.8})):Play()end)k.InputEnded:Connect(function(l)(main.tweenService:Create(w,TweenInfo.new(.2),{BackgroundTransparency=1})):Play()end)k.Parent=l end spawn(function()wait(.1)U(l,l["\065\110\115\119\101\114"..#G.Answers],l.Question)end)end if M==1 then local M=UDim2.new(1,-255,1,-155)if main.device~="\077\111\098\105\108\101"and n.Position~=M then n.Position=M n.Size=UDim2.new(0,250,0,150)end local C=W.InfoFrame local s C.Visible=false W.Desc.Visible=false W.InputFrame.Visible=false local k=G[1]if k=="\073\110\102\111"then W.Desc.Text=G[2]W.Desc.Visible=true elseif k=="\073\110\112\117\116"then local M=G[2]local s=W.InputFrame.Frame.TextBox local k=main.commandSpeeds[l]W.InputFrame.InputName.Text=M.."\058"s.Text=k if main.infoFramesViewed[M]then main.infoFramesViewed[M]=nil if M=="\083\112\101\101\100"then local l={}if main.device=="\067\111\109\112\117\116\101\114"then l={{"\077\111\118\101\109\101\110\116";"\087\065\083\068"};{"\084\111\103\103\108\101 \102\108\105\103\104\116";"\069"},{"\085\112 \038 \068\111\119\110","\082 \038 \070"}}else l={{"\077\111\118\101\109\101\110\116","\084\104\117\109\098\115\116\105\099\107"},{"\084\111\103\103\108\101 \102\108\105\103\104\116","\068\111\117\098\108\101-\106\117\109\112"}}end for G=1,3,1 do local M=C["\073\110\102\111"..G]local s=l[G]if s then M.Text=s[1].."\058"M.TextLabel.Text=s[2]M.Visible=true else M.Visible=false end end C.Okay.MouseButton1Down:Connect(function()C.Visible=false end)C.Visible=true end end local w=s.Text s.FocusLost:Connect(function()local G=tonumber(s.Text)if not G then G=k end local M="\046\046\046"s.Text=M local C=main.signals.RequestCommand:InvokeServer(main.pdata.Prefix..(l..(" \109\101 "..G)))if not C then s.Text=w end w=s.Text end)W.InputFrame.Visible=true end module:UpdateCommandMenu(l,n)W.ChangeStatus.MouseButton1Down:Connect(function()W.Loading.Visible=true if main.commandsToDisableCompletely[l]then local G if W.ChangeStatus.TextLabel.Text=="\068\073\083\065\066\076\069"then G="\033\085\110"..l else G="\033"..l end main.signals.RequestCommand:InvokeServer(G)wait(1)elseif main.commandsActive[l]then main.commandsActive[l]=nil else(main:GetModule("\099\102")):ActivateClientCommand(l)wait(.5)end module:UpdateCommandMenu(l,n)W.Loading.Visible=false end)elseif M==2 then if l=="\099\109\100\098\097\114\050"then w.Title.Text="\067\077\068\066\065\082\050"end if main.device~="\077\111\098\105\108\101"then n.Position=UDim2.new(0,5,1,-75)n.Size=UDim2.new(0,315,0,70)end local G=W.SearchFrame local M=G.TextBox local C={maxSuggestions=3,mainParent=W.Parent,textBox=M;rframe=G.ResultsFrame,suggestionPos=1;suggestionDisplayed=0,forceExecute=false,highlightColor=Color3.fromRGB(50,50,50),otherColor=Color3.fromRGB(80,80,80);suggestionLabels={},currentBarCommand=nil};(main:GetModule("\067\109\100\066\097\114")):SetupTextbox(l,C)local s=W.Loading W.Execute.MouseButton1Down:Connect(function()s.Visible=true if#M.Text>1 then local l=M.Text local G=string.sub(l,1,1)if G~=main.settings.UniversalPrefix and G~=main.pdata.Prefix then l=main.pdata.Prefix..l end local C=string.sub(l,-1)if C==" "then l=string.sub(l,1,-1)end main.signals.RequestCommand:InvokeServer(l)end s.Visible=false end)elseif M==3 then if l=="\099\109\100\098\097\114\050"then w.Title.Text="\067\077\068\066\065\082\050"end if main.device~="\077\111\098\105\108\101"then n.Position=UDim2.new(0,5,1,-110)n.Size=UDim2.new(0,315,0,105)end local G=W.PlayerFrame.SearchFrame local M=G.TextBox M.Text=main.player.Name local C={maxSuggestions=3;mainParent=W.Parent;textBox=M,rframe=G.ResultsFrame,suggestionPos=1,suggestionDisplayed=0;forceExecute=false;highlightColor=Color3.fromRGB(50,50,50),otherColor=Color3.fromRGB(80,80,80),suggestionLabels={};currentBarCommand=nil,specificArg="\112\108\097\121\101\114"};(main:GetModule("\067\109\100\066\097\114")):SetupTextbox(l,C)local s=W.MessageFrame.SearchFrame local k=s.TextBox k.FocusLost:connect(function(l)if l then local l=M.Text local G=string.sub(l,-1)if G==" "then l=string.sub(l,1,-1)end local C=main.pdata.Prefix..("\116\097\108\107"..(main.pdata.SplitKey..(l..(main.pdata.SplitKey..k.Text))))k.Text=""main.signals.RequestCommand:InvokeServer(C)end end)elseif M==4 then local l=G[1]local M=G[2]local C=W.ReplyFrame.TextBox local s=W.Send w.Title.Text="\077\101\115\115\097\103\101 \102\114\111\109 "..l.Name W.MessageFrame.Message.Text=M C.Changed:connect(function(l)if l=="\084\101\120\116"then if#C.Text>0 then s.TextLabel.TextColor3=Color3.fromRGB(255,255,255)s.AutoButtonColor=true else s.TextLabel.TextColor3=Color3.fromRGB(125,125,125)s.AutoButtonColor=false end end end)s.MouseButton1Down:Connect(function()if s.AutoButtonColor then module:DestroyCommandMenuFrame(n)main.signals.ReplyToPrivateMessage:InvokeServer({l;C.Text})end end)elseif M==5 then local l=G local M=math.ceil(k.ScrollFrame.AbsoluteSize.Y/11)local C=k.ScrollFrame.Template local s=M/3 local w=W.ScrollFrame local H=W.LoadMore local o=H.Displaying local L=H.Load w.Template:Destroy()n.Parent=main.gui local function N(l)local G=l.message local M=l.timeAdded local C=os.date("\042\116",M)local s=l.speakerName local k=C.hour local w=C.min if k<10 then k="\048"..k end if w<10 then w="\048"..w end return"\091"..(k..("\058"..(w..("\093 "..(s..("\058 "..G))))))end local b={}local c=20 local U=0 local q=0 local function j(l,G)U=math.min((l+G)-1,#b)for l=l,U,1 do local G=b[l]local C=G.TextLabel local s=main.textService:GetTextSize(C.Text,tonumber(C.TextSize),C.Font,Vector2.new(math.huge,M))local k=s.X if k>q then q=k end G.Parent=w end o.Text=("\037\100\047\037\100"):format(U,#b)local C=U<#b H.Visible=C w.Size=C and UDim2.new(1,0,.84,0)or UDim2.new(1,0,.92,0)w.CanvasSize=UDim2.new(0,q,0,U*M)end L.MouseButton1Click:Connect(function()j(U+1,c)end)local function e()b={}for l,G in pairs(w:GetChildren())do if G.Name~="\085\073\076\105\115\116\076\097\121\111\117\116"then G:Destroy()end end o.Text="\048\047\048"U=0 q=0 L.Visible=true end local function R(l)e()local G=0 for l,G in pairs(l)do local k=C:Clone()local w=k.TextLabel w.Text=N(G)k.BackgroundColor3=module:GetLabelBackgroundColor(l)k.Visible=true k.Name="\082\101\099\111\114\100"..l k.Size=UDim2.new(1,0,0,M)w.Position=UDim2.new(0,s,.15,0)w.Size=UDim2.new(1,-s*2,.7,0)b[#b+1]=k end j(1,c)end R(l)local E=true local x=W.SearchBar.Frame.TextBox local t={}x.FocusLost:connect(function(G)if E then E=false local G=string.lower(x.Text)local M={}for l,C in pairs(l)do local s=string.lower(N(C))if string.find(s,G,1,true)then table.insert(M,C)end end R(M)setupOriginalZIndex(w)updateZIndex(main.commandMenus,w)wait(.5)E=true end end)elseif M==6 then local M=W.ScrollFrame local C={["\065\071 \083\101\114\118\101\114"]="\067\117\114\114\101\110\116",["\065\074 \076\101\110\103\116\104"]="\073\110\102\105\110\105\116\101"}local s={}local k=M["\065\067 \084\097\114\103\101\116 \080\108\097\121\101\114"].SearchFrame local w=k.TextBox local H=G.targetPlayer local o=M["\065\074\065 \084\105\109\101"]local L=M["\065\065 \083\112\097\099\101"]local N=M["\065\090 \083\112\097\099\101"]local b=M["\065\088 \066\097\110"]local c=M["\065\077 \082\101\097\115\111\110"].SearchFrame.TextBox local e=function(l,G,M)if l.Name==G then l.BackgroundTransparency=.1 l.TextLabel.TextColor3=Color3.fromRGB(255,255,255)s[M.Name]=G if M.Name=="\065\074 \076\101\110\103\116\104"then if l.Name=="\084\105\109\101"then o.Visible=true else o.Visible=false end end else l.BackgroundTransparency=.8 l.TextLabel.TextColor3=Color3.fromRGB(150,150,150)end end local R={C;e,M,N;L}local E=function(l)if l.Name=="\065\071 \083\101\114\118\101\114"then q(l,G.server,R)elseif l.Name=="\065\074 \076\101\110\103\116\104"then q(l,G.length,R)end end j(C,M,w,R,E,o,H)local x={maxSuggestions=3,mainParent=W.Parent,textBox=w;rframe=k.ResultsFrame,suggestionPos=1;suggestionDisplayed=0;forceExecute=false,highlightColor=Color3.fromRGB(50,50,50),otherColor=Color3.fromRGB(80,80,80),suggestionLabels={};currentBarCommand=nil,specificArg="\112\108\097\121\101\114"};(main:GetModule("\067\109\100\066\097\114")):SetupTextbox(l,x)local t=G.timeDetails if t then t:gsub("\037\100\043\037\097",function(l)local G=tonumber(l:match("\037\100\043"))if G then local M=l:match("\037\097")local C,s,k=(main:GetModule("\099\102")):GetTimeAmount(M,G)o[s].TextBox.Text=k end return end)end local O=G.reason if O and(O~=""and O~=" ")then c.Text=O end b.MouseButton1Down:Connect(function()local l=c.Text local G=w.Text local M,C,k=o.Minutes.TextBox.Text,o.Hours.TextBox.Text,o.Days.TextBox.Text local W={server=s["\065\071 \083\101\114\118\101\114"];length=s["\065\074 \076\101\110\103\116\104"],lengthTime=M..("\109"..(C..("\104"..(k.."\100"))))}module:DestroyCommandMenuFrame(n)main.signals.RequestCommand:InvokeServer(main.pdata.Prefix..("\100\105\114\101\099\116\066\097\110"..(main.pdata.SplitKey..(G..(main.pdata.SplitKey..l)))),W)end)spawn(function()wait(.1)U(M,N,L)end)elseif M==7 then local G=W.ScrollFrame local M={["\065\071 \068\105\115\112\108\097\121\070\114\111\109"]="\069\110\097\098\108\101\100"}local C={}local s=G["\065\074 \077\101\115\115\097\103\101\067\111\108\111\114"].SearchFrame local k=s.TextBox local w=G["\065\088 \083\117\098\109\105\116"]local H=G["\065\090 \076\111\097\100\105\110\103"]local o=G["\065\070 \084\105\116\108\101"]local L=G["\065\067 \077\101\115\115\097\103\101\084\105\116\108\101"].SearchFrame.TextBox local N=G["\065\077 \077\101\115\115\097\103\101"].SearchFrame.TextBox local b=function(l,G,M)if l.Name==G then l.BackgroundTransparency=.1 l.TextLabel.TextColor3=Color3.fromRGB(255,255,255)C[M.Name]=G else l.BackgroundTransparency=.8 l.TextLabel.TextColor3=Color3.fromRGB(150,150,150)end end local c={M,b;G}o.TextLabel.Text="\068\105\115\112\108\097\121 \'\070\114\111\109 "..(main.player.Name.."\'")local U=function(l)if l.Name=="\065\071 \068\105\115\112\108\097\121\070\114\111\109"then q(l,"\069\110\097\098\108\101\100",c)end end j(M,G,k,c,U)local R={maxSuggestions=3;mainParent=W.Parent,textBox=k;rframe=s.ResultsFrame;suggestionPos=1,suggestionDisplayed=0,forceExecute=false;highlightColor=Color3.fromRGB(50,50,50),otherColor=Color3.fromRGB(80,80,80);suggestionLabels={};currentBarCommand=nil;specificArg="\099\111\108\111\114"};(main:GetModule("\067\109\100\066\097\114")):SetupTextbox(l,R)local E=n.FinalResult local x=E.Frame local t=x.Example local O=function()local l=false if C["\065\071 \068\105\115\112\108\097\121\070\114\111\109"]=="\069\110\097\098\108\101\100"then l=true end local G=main.signals.RetrieveBroadcastData:InvokeServer({Title=L.Text,DisplayFrom=l,Color=k.Text;Message=N.Text})return G end local v=function(l)t.Title.Text=l.Title local G=l.DisplayFrom t.Pic.Visible=G t.SubTitle.Visible=G if G then t.Pic.Image=module:GetUserImage(l.SenderId)t.SubTitle.Text="\070\114\111\109 "..l.SenderName end t.Desc.TextColor3=Color3.new(l.Color[1],l.Color[2],l.Color[3])t.Desc.Text=l.Message E.Visible=true end local A=function()main.signals.ExecuteBroadcast:InvokeServer()end e(n,w,H,O,v,A)elseif M==8 then local l=G[1]local M=G[2]local C=w.Mute local s=C.TextLabel local k="\240\159\148\138"local H="\240\159\148\135"local o=Instance.new("\083\111\117\110\100")o.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047"..main.pdata.AlertSoundId o.Volume=main.pdata.AlertVolume o.Pitch=main.pdata.AlertPitch o.Looped=true o.Parent=n o:Play()w.Title.Text=l W.MessageFrame.Message.Text=M C.MouseButton1Down:Connect(function()if s.Text==k then s.Text=H o:Pause()else s.Text=k o:Play()end end)elseif M==9 then local M=W.ScrollFrame local C={["\065\067 \083\101\114\118\101\114"]="\067\117\114\114\101\110\116";["\065\071 \083\104\111\119\082\101\115\117\108\116\115\084\111"]="\089\111\117"}local s={}local k=M["\065\068 \084\097\114\103\101\116 \080\108\097\121\101\114"]local w=k.SearchFrame local H=w.TextBox local o=G.targetPlayer local L=M["\065\065 \083\112\097\099\101"]local N=M["\065\090 \083\112\097\099\101"]local b=M["\065\090 \076\111\097\100\105\110\103"]local c=M["\065\088 \083\117\098\109\105\116"]local E=M["\065\080 \081\117\101\115\116\105\111\110"].SearchFrame.TextBox local x=function(l,G,M)local C=M.Name if l.Name==G then l.BackgroundTransparency=.1 l.TextLabel.TextColor3=Color3.fromRGB(255,255,255)s[M.Name]=G if C=="\065\067 \083\101\114\118\101\114"then if l.Name=="\067\117\114\114\101\110\116"then k.Visible=true else k.Visible=false end end else l.BackgroundTransparency=.8 l.TextLabel.TextColor3=Color3.fromRGB(150,150,150)end end local t={C;x;M;N,L}local O=function(l)if l.Name=="\065\067 \083\101\114\118\101\114"then q(l,G.server,t)elseif C[l.Name]then q(l,C[l.Name],t)end end j(C,M,H,t,O,nil,o)local v={maxSuggestions=3;mainParent=W.Parent,textBox=H,rframe=w.ResultsFrame;suggestionPos=1;suggestionDisplayed=0,forceExecute=false,highlightColor=Color3.fromRGB(50,50,50),otherColor=Color3.fromRGB(80,80,80);suggestionLabels={};currentBarCommand=nil,specificArg="\112\108\097\121\101\114"};(main:GetModule("\067\109\100\066\097\114")):SetupTextbox(l,v)local A=G.question if A and(A~=""and A~=" ")then E.Text=A end local Q=10 local X=M["\065\083 \065\110\115\119\101\114"]local h=M["\065\084 \065\100\100\065\110\115\119\101\114"]local u={}X.Visible=false local function Z(l)for G,M in pairs(u)do if M==l then table.remove(u,G)break end end l:Destroy()U(M,N,L)end local function V()local l=X:Clone()l.Visible=true l.Parent=M l.RemoveBox.MouseButton1Down:Connect(function()Z(l)end)table.insert(u,l)U(M,N,L)return l end local p=G.answers if type(p)=="\116\097\098\108\101"then for l,G in pairs(p)do if G and(G~=""and G~=" ")then local l=V()l.SearchFrame.TextBox.Text=G if#u>=Q then break end end end end h.Add.MouseButton1Down:Connect(function()if#u>=Q then(main:GetModule("\078\111\116\105\099\101\115")):Notice("\069\114\114\111\114",main.hdAdminCoreName,"\067\097\110\110\111\116 \101\120\099\101\101\100 "..(Q.." \097\110\115\119\101\114\115\033"))else local l=V()M.CanvasPosition=Vector2.new(0,M.CanvasPosition.Y+l.AbsoluteSize.Y)end end)local m=M["\065\067 \086\111\116\101\084\105\109\101"]local J=m.SearchFrame.TextBox local Y=J.Text J.FocusLost:connect(function(l)local G=tonumber(J.Text)if G then if G<1 then G=1 elseif G>60 then G=60 end else G=Y end J.Text=G Y=G end)spawn(function()wait(.1)U(M,N,L)end)local S=n.FinalResult local I=S.Frame local K=I.Example local r=function()local l=J.Text local G=E.Text local M=s["\065\067 \083\101\114\118\101\114"]local C=s["\065\071 \083\104\111\119\082\101\115\117\108\116\115\084\111"]local k=H.Text:gsub(" ",function(l)return""end)local w={}for l,G in pairs(u)do table.insert(w,G.SearchFrame.TextBox.Text)end local W=main.signals.RetrievePollData:InvokeServer({VoteTime=l,Question=G;Answers=w,Server=M;ShowResultsTo=C,PlayerArg=k})return W end local f=function(l)R(K,l)S.Visible=true end local B=function()main.signals.ExecutePoll:InvokeServer()end e(n,c,b,r,f,B)elseif M==10 then main.audio.Notice:Play()local l=W.ScrollFrame local M=l.Question.TextLabel local C=w.Title local s=G local k=s.VoteTime local H=k+1 R(l,s)M.Text=s.Question;(coroutine.wrap(function()for l=1,k,1 do C.Text=string.upper(s.SenderName)..("\'\083 \080\079\076\076 \040"..(H-l.."\041"))wait(1)end module:DestroyCommandMenuFrame(n)end))()elseif M==11 then main.audio.Notice:Play()local l=(main:GetModule("\099\102")):RandomiseTable({Color3.fromRGB(220,30,30),Color3.fromRGB(220,93,29),Color3.fromRGB(188,161,23),Color3.fromRGB(107,186,22);Color3.fromRGB(19,179,46);Color3.fromRGB(20,197,197);Color3.fromRGB(24,120,255),Color3.fromRGB(101,24,255),Color3.fromRGB(217,24,255),Color3.fromRGB(255,24,128)})local M=W.ScrollFrame local C=M.Question.TextLabel local s=w.Title local k=G C.Text=k.Question local H=M.ResultTemplate H.Visible=false local o=#k.Results for G,C in pairs(k.Results)do local s=H:Clone()s.Visible=true s.Name="\065\110\115\119\101\114"..G s.Bar.BackgroundColor3=l[G]local k=G..("\046 "..(C.Answer.." \040"))if G==o then k=C.Answer.." \040"s.Bar.BackgroundColor3=Color3.fromRGB(175,175,175)end s.TextLabel.Text=k.."\048\041"s.BackgroundColor3=module:GetLabelBackgroundColor(G)s.Bar.Size=UDim2.new(0,0,1,0)delay((G-1)/10,function()local l=2 local G=TweenInfo.new(l,Enum.EasingStyle.Quart)local M=Instance.new("\073\110\116\086\097\108\117\101")M.Value=0;(main.tweenService:Create(s.Bar,G,{Size=UDim2.new(C.Percentage,0,1,0)})):Play();(main.tweenService:Create(M,G,{Value=C.Votes})):Play()M.Changed:Connect(function(l)s.TextLabel.Text=k..(l.."\041")end)wait(l)M:Destroy()end)s.Parent=M end spawn(function()wait(.1)U(M,M["\065\110\115\119\101\114"..#k.Answers],M.Question)end)elseif M==12 then local M=W.ScrollFrame local C={["\065\067 \083\101\114\118\101\114"]="\067\117\114\114\101\110\116"}local s={}local k=M["\065\068 \084\097\114\103\101\116 \080\108\097\121\101\114"]local w=k.SearchFrame local H=w.TextBox local o=G.targetPlayer local L=M["\065\065 \083\112\097\099\101"]local N=M["\065\090 \083\112\097\099\101"]local b=M["\065\088 \083\112\097\099\101"]local c=M["\065\090 \076\111\097\100\105\110\103"]local U=M["\065\088 \083\117\098\109\105\116"]local R=M["\065\071 \077\101\115\115\097\103\101\084\105\116\108\101"].SearchFrame.TextBox local E=M["\065\077 \077\101\115\115\097\103\101"].SearchFrame.TextBox local x=function(l,G,M)local C=M.Name if l.Name==G then l.BackgroundTransparency=.1 l.TextLabel.TextColor3=Color3.fromRGB(255,255,255)s[M.Name]=G if C=="\065\067 \083\101\114\118\101\114"then if l.Name=="\067\117\114\114\101\110\116"then k.Visible=true b.Visible=false else k.Visible=false b.Visible=true end end else l.BackgroundTransparency=.8 l.TextLabel.TextColor3=Color3.fromRGB(150,150,150)end end local t={C,x;M;N;L}local O=function(l)if l.Name=="\065\067 \083\101\114\118\101\114"then q(l,G.server,t)elseif C[l.Name]then q(l,C[l.Name],t)end end j(C,M,H,t,O,nil,o)local v={maxSuggestions=3,mainParent=W.Parent,textBox=H;rframe=w.ResultsFrame;suggestionPos=1;suggestionDisplayed=0,forceExecute=false;highlightColor=Color3.fromRGB(50,50,50),otherColor=Color3.fromRGB(80,80,80);suggestionLabels={};currentBarCommand=nil;specificArg="\112\108\097\121\101\114"};(main:GetModule("\067\109\100\066\097\114")):SetupTextbox(l,v)local A=G.message if A and(A~=""and A~=" ")then E.Text=A end R.Text="\065\108\101\114\116 \102\114\111\109 "..main.player.Name local Q=n.FinalResult local X=Q.Frame local h=X.Example local u=function()local l=R.Text local G=E.Text local M=s["\065\067 \083\101\114\118\101\114"]local C=H.Text:gsub(" ",function(l)return""end)local k=main.signals.RetrieveAlertData:InvokeServer({Title=l;Message=G,Server=M,PlayerArg=C})return k end local Z=function(l)h.Title.Text=l.Title h.Message.Text=l.Message Q.Visible=true end local V=function()main.signals.ExecuteAlert:InvokeServer()end e(n,U,c,u,Z,V)end setupOriginalZIndex(n,C)table.insert(main.commandMenus,n)updateZIndex(main.commandMenus)end n.Parent=main.gui n.Visible=true end function module.GetMousePoint(G,l)local M=main.camera:ScreenPointToRay(main.lastHitPosition.X,main.lastHitPosition.Y)local C=Ray.new(M.Origin,M.Direction*100)local s,k=workspace:FindPartOnRay(C,main.player.Character)return s,k end function module.GetLabelBackgroundColor(G,l)if l%2==0 then return Color3.fromRGB(50,50,50)else return Color3.fromRGB(40,40,40)end end function module.GenerateTagFromId(G,l)local M=main.alphabet local C=#M local s=math.ceil(l/#M)local k=math.ceil(l/(#M)^2)local w=M[l%C]or M[C]local W=M[s%C]or M[C]local H=M[k%C]or M[C]return H..(W..w)end function module.ClearPage(G,l)for l,G in pairs(l:GetChildren())do if G.Name~="\085\073\076\105\115\116\076\097\121\111\117\116"and string.sub(G.Name,1,8)~="\084\101\109\112\108\097\116\101"then G:Destroy()elseif G:IsA("\070\114\097\109\101")then G.Visible=false end end end function module.UpdateClientData(l)main.pdata=main.rfunction:InvokeServer("\082\101\116\114\105\101\118\101\080\108\097\121\101\114\068\097\116\097")end

function module:ReplicateEffect(commandName, args)
	main.signals.ReplicateEffect:FireServer(commandName, args)
end

function module:UpdateIconVisiblity()
	local newTransparency = (main.pdata.Rank >= main.settings.RankRequiredToViewIcon and 0) or 1
	main.tweenService:Create(main.gui.CustomTopBar.ImageButton, TweenInfo.new(1), {ImageTransparency = newTransparency}):Play()
end

function module:DeactivateCommand(commandName)
	main.commandsAllowedToUse[commandName] = nil
	main.commandsActive[commandName] = nil
	if not main.commandsToDisableCompletely[commandName] then
		local frame = main.gui:FindFirstChild("CommandMenu"..commandName)
		main:GetModule("cf"):DestroyCommandMenuFrame(frame)
	end
end

function module:EndCommand(commandName)
	main.commandsActive[commandName] = nil
	main:GetModule("cf"):UpdateCommandMenu(commandName)
end

function module:ActivateClientCommand(commandName, extraDetails)
	if main.commandsAllowedToUse[commandName] and not main.commandsActive[commandName] then
		if not(extraDetails and extraDetails.DontForceActivate and main.gui:FindFirstChild("CommandMenu"..commandName)) then
			main.commandsActive[commandName] = true
			spawn(function()
				main:GetModule("cf"):UpdateCommandMenu(commandName)
				local clientCommand = main:GetModule("ClientCommands")[commandName]
				if clientCommand then
					local Function = clientCommand["Activate"]
					if Function then
						Function(clientCommand)
					end
				end
				main.commandsActive[commandName] = nil
			end)
		end
	end
end

function module:GetCF(part, isFor)
	--Credit to Scel for this
	local cframe = part.CFrame
	local noRot = CFrame.new(cframe.p)
	local x, y, z = (workspace.CurrentCamera.CFrame - workspace.CurrentCamera.CFrame.p):toEulerAnglesXYZ()
	return noRot * CFrame.Angles(isFor and z or x, y, z)
end

function module:GetNextMovement(deltaTime, speed)
	local nextMove = Vector3.new()
	local directions = {
		Left = Vector3.new(-1, 0, 0);
		Right = Vector3.new(1, 0, 0);
		Forwards = Vector3.new(0, 0, -1);
		Backwards = Vector3.new(0, 0, 1);
		Up = Vector3.new(0, 1, 0);
		Down = Vector3.new(0, -1, 0);
	}
	if main.device == "Computer" then
		for i,v in pairs(main.movementKeysPressed) do
			local vector = directions[v]
			if vector then
				nextMove = nextMove + vector
			end
		end
	else
		local humanoid = main:GetModule("cf"):GetHumanoid()
		local hrp = main:GetModule("cf"):GetHRP()
		if humanoid then
			local md = humanoid.MoveDirection
			for i,v in pairs(directions) do
				local isFor = false
				if i == "Forwards" or i == "Backwards" then
					isFor = true
				end
				local vector = ((module:GetCF(hrp, true)*CFrame.new(v)) - hrp.CFrame.p).p;
				if (vector - md).magnitude <= 1.05 and md ~= Vector3.new(0,0,0) then
					nextMove = nextMove + v
				end
			end
		end
	end
	return CFrame.new(nextMove * speed * deltaTime), nextMove
end

function module:GetAssetImage(assetId)
	return("https://www.roblox.com/asset-thumbnail/image?assetId="..assetId.."&width=420&height=420&format=png")
end

function module:GetUserImage(userId)
	return("https://www.roblox.com/headshot-thumbnail/image?userId="..userId.."&width=420&height=420&format=png")
end

function module:ShowPermRankedUser(details)
	local plrName, userId, rankedById = details[1], details[2], details[3]
	permRank.PlrName.Text = plrName
	permRank.PlrImage.Image = module:GetUserImage(userId)
	permRank.RankedBy.TextLabel.Text = main:GetModule("cf"):GetName(rankedById)
	main:GetModule("cf"):ShowWarning("PermRank")
end

function module:ShowBannedUser(banDetails)
	local plrName, userId, reason, bannedById = banDetails[1], banDetails[2], banDetails[3], banDetails[4]
	local reasonLabel = unBan.Reason.TextLabel
	unBan.PlrName.Text = plrName
	unBan.PlrImage.Image = module:GetUserImage(userId)
	unBan.BannedBy.TextLabel.Text = main:GetModule("cf"):GetName(bannedById)
	reasonLabel.Text = "'"..reason.."'"
	if reasonLabel.Text == "" or reasonLabel.Text == " " then
		reasonLabel.Text = "Empty"
		reasonLabel.Font = Enum.Font.SourceSansItalic
	else
		reasonLabel.Font = Enum.Font.SourceSans
	end
	main:GetModule("cf"):ShowWarning("UnBan")
end

function module:ShowWarning(warningName)
	for a,b in pairs(main.warnings:GetChildren()) do
		if b.Name == warningName then
			b.Visible = true
			main.warnings.Visible = true
		else
			b.Visible = false
		end
	end
end

function module:SetCameraSubject(newSubject)
	local face = main:GetModule("cf"):GetFace()
	if face then
		local originalT = face.Transparency
		main.camera.CameraSubject = newSubject
		face.Transparency = originalT
	end
end

function module:DestroyCommandMenuFrame(frame)
	if frame then
		for i,v in pairs(main.commandMenus) do
			if v == frame then
				table.remove(main.commandMenus, i)
			end
		end
		frame:Destroy()
	end
end

function module:UpdateCommandMenu(commandName, frame)
	if frame == nil then
		frame = main.gui:FindFirstChild("CommandMenu"..commandName)
	end
	if frame then
		local mainFrame = frame.MainFrame
		local status = mainFrame:FindFirstChild("Status")
		if status then
			if (main.commandsToDisableCompletely[commandName] and main.commandsAllowedToUse[commandName]) or main.commandsActive[commandName] then
				mainFrame.Status.TextLabel.Text = "On"
				mainFrame.Status.TextLabel.TextColor3 = Color3.fromRGB(0, 225, 0)
				mainFrame.ChangeStatus.TextLabel.Text = "DISABLE"
			else
				mainFrame.Status.TextLabel.Text = "Off"
				mainFrame.Status.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
				mainFrame.ChangeStatus.TextLabel.Text = "ENABLE"
			end
		end
	end
end
function module:CreateNewCommandMenu(commandName, menuDetails, menuType, forceOnTop)
	----------------------
	local framesToDestroyOnClose = {4, 5, 8, 11, 12}
	local framesWithIncrementalNames = {4}
	local framesToDestroyExistingFrames = {--[[1,]] 5, 6, 7, 9, 12}
	----------------------
	menuType = tonumber(menuType)
	local destroyFrameOnClose = main:GetModule("cf"):FindValue(framesToDestroyOnClose, menuType)
	local isAnIncrementalName = main:GetModule("cf"):FindValue(framesWithIncrementalNames, menuType)
	local destroyExistingFrames = main:GetModule("cf"):FindValue(framesToDestroyExistingFrames, menuType)
	local frameName = "CommandMenu"..commandName
	if isAnIncrementalName then
		frameName = "CommandMenu"..commandName..pmId
		pmId = pmId + 1
	end
	local frame = main.gui:FindFirstChild(frameName)
	if frame and destroyExistingFrames then
		frame:Destroy()
		frame = nil
	end
	if not frame then
		local frameTemplate = menuTemplates["Template"..menuType]
		local mainFrameTemplate = frameTemplate.MainFrame
		frame = frameTemplate:Clone()
		frame.Name = frameName
		local dragBar = frame.DragBar
		local mainFrame = frame.MainFrame
		local commandNameSplit = string.upper(string.gsub(commandName, "%u", function(c) return " "..c end))
		dragBar.Title.Text = commandNameSplit
		main:GetModule("InputHandler"):MakeFrameDraggable(frame)
		dragBar.Close.MouseButton1Down:Connect(function()
			if destroyFrameOnClose then
				module:DestroyCommandMenuFrame(frame)
			else
				frame.Visible = false
			end
		end)
		local originalY = mainFrame.Position.Y.Scale
		local yTweenTarget = -(1 - dragBar.Size.Y.Scale - originalY)
		local minimise = dragBar:FindFirstChild("Minimise")
		if minimise then
			minimise.MouseButton1Down:Connect(function()
				if minimise.TextLabel.Text == "-" then
					main.tweenService:Create(mainFrame, TweenInfo.new(0.5), {Position = UDim2.new(0,0,yTweenTarget,-1)}):Play()
					minimise.TextLabel.Text = "+"
				else
					main.tweenService:Create(mainFrame, TweenInfo.new(0.5), {Position = UDim2.new(0,0,originalY,0)}):Play()
					minimise.TextLabel.Text = "-"
				end
			end)
		end
		
		-- << SHARED >>
		--updateCanvasSize(scrollFrame, scrollFrame["Answer"..#data.Answers], scrollFrame.Question)
		local function updateCanvasSize(scrollFrame, finalLabel, firstLabel)
			scrollFrame.CanvasSize = UDim2.new(0, 0, 0, (finalLabel.AbsolutePosition.Y - firstLabel.AbsolutePosition.Y) + finalLabel.AbsoluteSize.Y)
		end
		
		local function selectToggle(selectFrame, toggleName, ov)
			local defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel = ov[1],ov[2],ov[3],ov[4],ov[5]
			local button = selectFrame:FindFirstChild(toggleName)
			if not button then
				toggleName = defaultToggles[selectFrame.Name]
			end
			---------------
			if selectFrame.Name == "AC Server" and toggleName == "All" and main.pdata.Rank < main.commandRanks.globalvote then
				main:GetModule("Notices"):Notice("Error", main.hdAdminCoreName, "Must be '".. main:GetModule("cf"):GetRankName(main.commandRanks.globalvote).."' to use ;globalVote")
			else
			--------------
				for a,b in pairs(selectFrame:GetChildren()) do
					if b:IsA("TextButton") then
						finalFunction(b, toggleName, selectFrame)
					end
				end
				if finalLabel and firstLabel then
					updateCanvasSize(scrollFrame, finalLabel, firstLabel)
				end
			end
		end
		
		local function setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, timeFrame, playerValue)
			local focused = false
			playerTextBox.Focused:Connect(function()
				focused = true
			end)
			playerTextBox.FocusLost:Connect(function()
				wait()
				focused = false
			end)
			for frameName, _ in pairs(defaultToggles) do
				local selectFrame = scrollFrame[frameName]
				for a,b in pairs(selectFrame:GetChildren()) do
					if b:IsA("TextButton") then
						b.MouseButton1Down:Connect(function()
							if not focused then
								selectToggle(selectFrame, b.Name, organisedVariables)
							end
						end)
					end
				end
				setupFunction(selectFrame)
			end
			if timeFrame then
				for a,b in pairs(timeFrame:GetChildren()) do
					local textBox = b:FindFirstChild("TextBox")
					if textBox then
						local originalNumber = textBox.Text
						textBox.Focused:Connect(function()
							focused = true
						end)
						textBox.FocusLost:connect(function(property)
							local newNumber = tonumber(textBox.Text)
							if newNumber then
								if newNumber < 0 then
									newNumber = 0
								elseif b.Name == "Minutes" and newNumber > 60 then
									newNumber = 60
								elseif b.Name == "Hours" and newNumber > 24 then
									newNumber = 24
								elseif b.Name == "Days" and newNumber > 100000 then
									newNumber = 100000
								end
								originalNumber = newNumber
							end
							textBox.Text = originalNumber
							wait()
							focused = false
						end)
					end
				end
			end
			if playerValue then
				local lowerPlayerValue = string.lower(playerValue)
				local newPlayerValue = playerValue
				for i,v in pairs(main.qualifiers) do
					if v == lowerPlayerValue then
						newPlayerValue = v
						break
					end
				end
				if not newPlayerValue then
					for i,plr in pairs(main.players:GetChildren()) do
						if string.sub(string.lower(plr.Name), 1, #lowerPlayerValue) == lowerPlayerValue then
							newPlayerValue = plr.Name
							break
						end
					end
				end
				playerTextBox.Text = newPlayerValue or ""
			end
		end
		
		local function setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
			local fr = frame.FinalResult
			local frFrame = fr.Frame
			local example = frFrame.Example
			local frLoading = frFrame.Loading
			local frBroadcast = frFrame.Broadcast
			fr.Visible = false
			frFrame.CloseX.MouseButton1Down:Connect(function()
				fr.Visible = false
			end)
			frBroadcast.MouseButton1Down:Connect(function()
				frLoading.Visible = true
				frBroadcast.Visible = false
				broadcastFunction()
				module:DestroyCommandMenuFrame(frame)
			end)
			submitButton.MouseButton1Down:Connect(function()
				loadingButton.Visible = true
				submitButton.Visible = false
				local data = serverInvocationFunction()
				if type(data) == "table" then
					retrievedDataFunction(data)
				else
					local errorMessage = tostring(data) or "Error"
					loadingButton.TextLabel.Text = errorMessage
					wait(1)
					loadingButton.TextLabel.Text = "Loading..."
				end
				loadingButton.Visible = false
				submitButton.Visible = true
			end)
		end
		
		local function setupPollResults(scrollFrame, data)
			local exampleAnswerTemplate = scrollFrame.AnswerTemplate
			exampleAnswerTemplate.Visible = false
			scrollFrame.Question.TextLabel.Text = data.Question
			for i,v in pairs(scrollFrame:GetChildren()) do
				if v:IsA("TextButton") and v ~= exampleAnswerTemplate then
					v:Destroy()
				end
			end
			for i,answer in pairs(data.Answers) do
				local answerButton = exampleAnswerTemplate:Clone()
				answerButton.Visible = true
				answerButton.Name = "Answer"..i
				answerButton.TextLabel.Text = i..". "..answer
				answerButton.BackgroundColor3 = module:GetLabelBackgroundColor(i)
				---------------
				local fade = answerButton.Fade
				local selectedAnswer = false
				if data.Remote then
					answerButton.MouseButton1Up:Connect(function()
						scrollFrame.Parent.Parent.Visible = false
						pcall(function() data.Remote:FireServer(i) end)
					end)
				end
				answerButton.InputBegan:Connect(function(input)
					main.tweenService:Create(fade, TweenInfo.new(0.2), {BackgroundTransparency = 0.8}):Play()
				end)
				answerButton.InputEnded:Connect(function(input)
					main.tweenService:Create(fade, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
				end)
				---------------
				answerButton.Parent = scrollFrame
			end
			spawn(function()
				wait(0.1)
				updateCanvasSize(scrollFrame, scrollFrame["Answer"..#data.Answers], scrollFrame.Question)
			end)
		end
		
		
		
		-------------- << MENU TYPE 1 >> --------------
		if menuType == 1 then
			local newPosition = UDim2.new(1, -255, 1, -155)
			if main.device ~= "Mobile" and frame.Position ~= newPosition then
				frame.Position = newPosition
				frame.Size = UDim2.new(0, 250, 0, 150)
			end
			local infoFrame = mainFrame.InfoFrame
			local min
			infoFrame.Visible = false
			mainFrame.Desc.Visible = false
			mainFrame.InputFrame.Visible = false
			local menuType = menuDetails[1]
			if menuType == "Info" then
				mainFrame.Desc.Text = menuDetails[2]
				mainFrame.Desc.Visible = true
			elseif menuType == "Input" then
				local inputType = menuDetails[2]
				local textBox = mainFrame.InputFrame.Frame.TextBox
				local defaultValue = main.commandSpeeds[commandName]
				mainFrame.InputFrame.InputName.Text = inputType..":"
				textBox.Text = defaultValue
				--
				if main.infoFramesViewed[inputType] then
					main.infoFramesViewed[inputType] = nil
					if inputType == "Speed" then
						local infoLabels = {}
						if main.device == "Computer" then
							infoLabels = {
								{"Movement", "WASD"};
								{"Toggle flight", "E"};
								{"Up & Down", "R & F"};
								}
						else
							infoLabels = {
								{"Movement", "Thumbstick"};
								{"Toggle flight", "Double-jump"};
								}
						end
						for i = 1,3 do
							local label = infoFrame["Info"..i]
							local labelInfo = infoLabels[i]
							if labelInfo then
								label.Text = labelInfo[1]..":"
								label.TextLabel.Text = labelInfo[2]
								label.Visible = true
							else
								label.Visible = false
							end
						end
						infoFrame.Okay.MouseButton1Down:Connect(function()
							infoFrame.Visible = false
						end)
						infoFrame.Visible = true
					end
				end
				local originalText = textBox.Text
				textBox.FocusLost:Connect(function()
					local newValue = tonumber(textBox.Text)
					if not newValue then
						newValue = defaultValue
					end
					local loadingText = "..."
					textBox.Text = loadingText
					local success = main.signals.RequestCommand:InvokeServer(main.pdata.Prefix..commandName.." me "..newValue)
					if not success then
						textBox.Text = originalText
					end
					originalText = textBox.Text
				end)
				mainFrame.InputFrame.Visible = true
			end
			module:UpdateCommandMenu(commandName, frame)
			mainFrame.ChangeStatus.MouseButton1Down:Connect(function()
				mainFrame.Loading.Visible = true
				if main.commandsToDisableCompletely[commandName] then
					local commandNameToSend
					if mainFrame.ChangeStatus.TextLabel.Text == "DISABLE" then
						commandNameToSend = "!Un"..commandName
					else
						commandNameToSend = "!"..commandName
					end
					main.signals.RequestCommand:InvokeServer(commandNameToSend)
					wait(1)
				elseif main.commandsActive[commandName] then
					main.commandsActive[commandName] = nil
				else
					main:GetModule("cf"):ActivateClientCommand(commandName)
					wait(0.5)
				end
				module:UpdateCommandMenu(commandName, frame)
				mainFrame.Loading.Visible = false
			end)
		
		
		
		-------------- << MENU TYPE 2 >> --------------
		elseif menuType == 2 then
			if commandName == "cmdbar2" then
				dragBar.Title.Text = "CMDBAR2"
			end
			if main.device ~= "Mobile" then
				frame.Position = UDim2.new(0, 5, 1, -75)
				frame.Size = UDim2.new(0, 315, 0, 70)
			end
			local searchFrame = mainFrame.SearchFrame
			local textBox = searchFrame.TextBox
			local props = {
				maxSuggestions = 3;
				mainParent = mainFrame.Parent;
				textBox = textBox;
				rframe = searchFrame.ResultsFrame;
				suggestionPos = 1;
				suggestionDisplayed = 0;
				forceExecute = false;
				highlightColor = Color3.fromRGB(50,50,50);
				otherColor = Color3.fromRGB(80,80,80);
				suggestionLabels = {};
				currentBarCommand = nil;
				}
			main:GetModule("CmdBar"):SetupTextbox(commandName, props)
			local loading = mainFrame.Loading
			mainFrame.Execute.MouseButton1Down:Connect(function()
				loading.Visible = true
				if #textBox.Text > 1 then
					local commandToRequest = textBox.Text
					local firstChar = string.sub(commandToRequest,1,1)
					if firstChar ~= main.settings.UniversalPrefix and firstChar ~= main.pdata.Prefix then
						commandToRequest = main.pdata.Prefix..commandToRequest
					end
					local endChar = string.sub(commandToRequest,-1)
					if endChar == " " then
						commandToRequest = string.sub(commandToRequest,1,-1)
					end
					main.signals.RequestCommand:InvokeServer(commandToRequest)
				end
				loading.Visible = false
			end)
		
		
		
		-------------- << MENU TYPE 3 >> --------------
		elseif menuType == 3 then
			if commandName == "cmdbar2" then
				dragBar.Title.Text = "CMDBAR2"
			end
			if main.device ~= "Mobile" then
				frame.Position = UDim2.new(0, 5, 1, -110)
				frame.Size = UDim2.new(0, 315, 0, 105)
			end
			
			local playerSearchFrame = mainFrame.PlayerFrame.SearchFrame
			local playerTextBox = playerSearchFrame.TextBox
			playerTextBox.Text = main.player.Name
			--
			local props = {
				maxSuggestions = 3;
				mainParent = mainFrame.Parent;
				textBox = playerTextBox;
				rframe = playerSearchFrame.ResultsFrame;
				suggestionPos = 1;
				suggestionDisplayed = 0;
				forceExecute = false;
				highlightColor = Color3.fromRGB(50,50,50);
				otherColor = Color3.fromRGB(80,80,80);
				suggestionLabels = {};
				currentBarCommand = nil;
				specificArg = "player";
				}
			main:GetModule("CmdBar"):SetupTextbox(commandName, props)
			--
			
			local messageSearchFrame = mainFrame.MessageFrame.SearchFrame
			local messageTextBox = messageSearchFrame.TextBox
			messageTextBox.FocusLost:connect(function(enter)
				if enter then
					local targetPlayerText = playerTextBox.Text
					local endChar = string.sub(targetPlayerText,-1)
					if endChar == " " then
						targetPlayerText = string.sub(targetPlayerText,1,-1)
					end
					local commandToRequest = main.pdata.Prefix.."talk"..main.pdata.SplitKey..targetPlayerText..main.pdata.SplitKey..messageTextBox.Text
					messageTextBox.Text = ""
					main.signals.RequestCommand:InvokeServer(commandToRequest)
				end
			end)
		
		
		
		-------------- << MENU TYPE 4 (messages) >> --------------
		elseif menuType == 4 then
			local speaker = menuDetails[1]
			local message = menuDetails[2]
			local textBox = mainFrame.ReplyFrame.TextBox
			local send = mainFrame.Send
			dragBar.Title.Text = "Message from "..speaker.Name
			mainFrame.MessageFrame.Message.Text = message
			textBox.Changed:connect(function(property)
				if property == "Text" then
					if #textBox.Text > 0 then
						send.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
						send.AutoButtonColor = true
					else
						send.TextLabel.TextColor3 = Color3.fromRGB(125, 125, 125)
						send.AutoButtonColor = false
					end
				end
			end)
			send.MouseButton1Down:Connect(function()
				if send.AutoButtonColor then
					module:DestroyCommandMenuFrame(frame)
					main.signals.ReplyToPrivateMessage:InvokeServer{speaker, textBox.Text}
				end
			end)
		
		
		
		-------------- << MENU TYPE 5 (logs) >> --------------
		elseif menuType == 5 then
			local log = menuDetails
			local labelY = math.ceil(mainFrameTemplate.ScrollFrame.AbsoluteSize.Y/11)
			local template = mainFrameTemplate.ScrollFrame.Template
			local marginX = labelY/3
			local scrollFrame = mainFrame.ScrollFrame
			local loadMoreFrame = mainFrame.LoadMore
			local displayingLabel = loadMoreFrame.Displaying
			local loadMore = loadMoreFrame.Load
			scrollFrame.Template:Destroy()
			frame.Parent = main.gui
			----
			local function getLabelText(record)
				local message = record.message
				local timeAdded = record.timeAdded-- -(record.timeAdded-os.time())
				local localTimeData = os.date("*t", timeAdded)
				local speakerName = record.speakerName
				local hour = localTimeData.hour
				local minute = localTimeData.min
				if hour < 10 then
					hour = "0"..hour
				end
				if minute < 10 then
					minute = "0"..minute
				end
				return("["..hour..":"..minute.."] "..speakerName..": "..message)
			end
			local logElements = {}
			local linesToLoadAtOnce = 20
			local currentDisplayIndex = 0
			local maxX = 0
			local function displayElements(index, range)
				currentDisplayIndex = math.min(index + range - 1, #logElements)
				for i = index, currentDisplayIndex do
					local label = logElements[i]
					local textLabel = label.TextLabel
					local labelTextSize = main.textService:GetTextSize(textLabel.Text, tonumber(textLabel.TextSize), textLabel.Font, Vector2.new(math.huge, labelY))
					local labelX = labelTextSize.X
					if labelX > maxX then
						maxX = labelX
					end
					label.Parent = scrollFrame
				end
				displayingLabel.Text = ("%d/%d"):format(currentDisplayIndex, #logElements)
				local showLoadMore = currentDisplayIndex < #logElements
				loadMoreFrame.Visible = showLoadMore
				scrollFrame.Size = (showLoadMore and UDim2.new(1,0,0.84,0)) or UDim2.new(1,0,0.92,0)
				scrollFrame.CanvasSize = UDim2.new(0, maxX, 0, currentDisplayIndex*labelY)
			end
			loadMore.MouseButton1Click:Connect(function()
				displayElements(currentDisplayIndex + 1, linesToLoadAtOnce)
			end)
			local function clearLogElements()
				logElements = {}
				for i,v in pairs(scrollFrame:GetChildren()) do
					if v.Name ~= "UIListLayout" then
						v:Destroy()
					end
				end
				displayingLabel.Text = "0/0"
				currentDisplayIndex = 0
				maxX = 0
				loadMore.Visible = true
			end
			local function updateLog(newLog)
				clearLogElements()
				local maxX = 0
				for i,record in pairs(newLog) do
					local label = template:Clone()
					local textLabel = label.TextLabel
					--print(labelText, tonumber(textLabel.TextSize), tostring(textLabel.Font), tostring(Vector2.new(labelY, math.huge)).." = ".. tostring(labelTextSize))
					textLabel.Text = getLabelText(record)
					label.BackgroundColor3 = module:GetLabelBackgroundColor(i)
					label.Visible = true
					label.Name = "Record"..i
					label.Size = UDim2.new(1,0,0,labelY)
					textLabel.Position = UDim2.new(0, marginX, 0.15, 0)
					textLabel.Size = UDim2.new(1,-marginX*2,0.7,0)
					logElements[#logElements+1] = label
				end
				displayElements(1, linesToLoadAtOnce)
			end
			updateLog(log)
			----
			local searchDe = true
			local textBox = mainFrame.SearchBar.Frame.TextBox
			local specialChars = {}
			textBox.FocusLost:connect(function(property)
				if searchDe then
					searchDe = false
					local searchText = string.lower(textBox.Text)
					local newLog = {}
					for i,record in pairs(log) do
						local labelText = string.lower(getLabelText(record))
						if string.find(labelText, searchText, 1, true) then
							table.insert(newLog, record)
						end
					end
					updateLog(newLog)
					setupOriginalZIndex(scrollFrame)
					updateZIndex(main.commandMenus, scrollFrame)
					wait(0.5)
					searchDe = true
				end
			end)
			----
		
		
		
		-------------- << MENU TYPE 6 (banMenu) >> --------------
		elseif menuType == 6 then
			local scrollFrame = mainFrame.ScrollFrame
			local defaultToggles = {["AG Server"] = "Current", ["AJ Length"] = "Infinite"}
			local selectedToggles = {}
			local playerSearchFrame = scrollFrame["AC Target Player"].SearchFrame
			local playerTextBox = playerSearchFrame.TextBox
			local playerValue = menuDetails.targetPlayer
			local timeFrame = scrollFrame["AJA Time"]
			local firstLabel = scrollFrame["AA Space"]
			local finalLabel = scrollFrame["AZ Space"]
			local banButton = scrollFrame["AX Ban"]
			local reasonTextBox = scrollFrame["AM Reason"].SearchFrame.TextBox
			local finalFunction = function(b, toggleName, selectFrame)
				if b.Name == toggleName then
					b.BackgroundTransparency = 0.1
					b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
					selectedToggles[selectFrame.Name] = toggleName
					if selectFrame.Name == "AJ Length" then
						if b.Name == "Time" then
							timeFrame.Visible = true
						else
							timeFrame.Visible = false
						end
					end
				else
					b.BackgroundTransparency = 0.8
					b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
				end
			end
			local organisedVariables = {defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel}
			local setupFunction = function(selectFrame)
				if selectFrame.Name == "AG Server" then
					selectToggle(selectFrame, menuDetails.server, organisedVariables)
				elseif selectFrame.Name == "AJ Length" then
					selectToggle(selectFrame, menuDetails.length, organisedVariables)
				end
			end
			setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, timeFrame, playerValue)
			local props = {
				maxSuggestions = 3;
				mainParent = mainFrame.Parent;
				textBox = playerTextBox;
				rframe = playerSearchFrame.ResultsFrame;
				suggestionPos = 1;
				suggestionDisplayed = 0;
				forceExecute = false;
				highlightColor = Color3.fromRGB(50,50,50);
				otherColor = Color3.fromRGB(80,80,80);
				suggestionLabels = {};
				currentBarCommand = nil;
				specificArg = "player";
				}
			main:GetModule("CmdBar"):SetupTextbox(commandName, props)
			--Time
			local timeDetails = menuDetails.timeDetails
			if timeDetails then
				timeDetails:gsub("%d+%a", function(c)
					local d = tonumber(c:match("%d+"))
					if d then
						local timeType = c:match("%a")
						local amount, frameName, newD = main:GetModule("cf"):GetTimeAmount(timeType, d)
						timeFrame[frameName].TextBox.Text = newD
					end
					return
				end)
			end
			--
			local defaultReason = menuDetails.reason
			if defaultReason and defaultReason ~= "" and defaultReason ~= " " then
				reasonTextBox.Text = defaultReason
			end
			banButton.MouseButton1Down:Connect(function()
				local banReason = reasonTextBox.Text
				local playerName = playerTextBox.Text
				local minutes, hours, days = timeFrame.Minutes.TextBox.Text, timeFrame.Hours.TextBox.Text, timeFrame.Days.TextBox.Text
				local details = {server=selectedToggles["AG Server"], length=selectedToggles["AJ Length"], lengthTime=minutes.."m"..hours.."h"..days.."d"}
				module:DestroyCommandMenuFrame(frame)
				main.signals.RequestCommand:InvokeServer(main.pdata.Prefix.."directBan"..main.pdata.SplitKey..playerName..main.pdata.SplitKey..banReason, details)
			end)
			spawn(function()
				wait(0.1)
				updateCanvasSize(scrollFrame, finalLabel, firstLabel)
			end)
			
		
		-------------- << MENU TYPE 7 (global announcement) >> --------------
		elseif menuType == 7 then
			local scrollFrame = mainFrame.ScrollFrame
			local defaultToggles = {["AG DisplayFrom"] = "Enabled"}
			local selectedToggles = {}
			local colorSearchFrame = scrollFrame["AJ MessageColor"].SearchFrame
			local colorTextBox = colorSearchFrame.TextBox
			local submitButton = scrollFrame["AX Submit"]
			local loadingButton = scrollFrame["AZ Loading"]
			local displayFromTitle = scrollFrame["AF Title"]
			local titleTextBox = scrollFrame["AC MessageTitle"].SearchFrame.TextBox
			local messageTextBox = scrollFrame["AM Message"].SearchFrame.TextBox
			local finalFunction = function(b, toggleName, selectFrame)
				if b.Name == toggleName then
					b.BackgroundTransparency = 0.1
					b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
					selectedToggles[selectFrame.Name] = toggleName
				else
					b.BackgroundTransparency = 0.8
					b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
				end
			end
			local organisedVariables = {defaultToggles, finalFunction, scrollFrame, --[[finalLabel, firstLabel--]]}
			displayFromTitle.TextLabel.Text = "Display 'From ".. main.player.Name.."'"
			local setupFunction = function(selectFrame)
				if selectFrame.Name == "AG DisplayFrom" then
					selectToggle(selectFrame, "Enabled", organisedVariables)
				end
			end
			setupDefaultToggles(defaultToggles, scrollFrame, colorTextBox, organisedVariables, setupFunction)
			local props = {
				maxSuggestions = 3;
				mainParent = mainFrame.Parent;
				textBox = colorTextBox;
				rframe = colorSearchFrame.ResultsFrame;
				suggestionPos = 1;
				suggestionDisplayed = 0;
				forceExecute = false;
				highlightColor = Color3.fromRGB(50,50,50);
				otherColor = Color3.fromRGB(80,80,80);
				suggestionLabels = {};
				currentBarCommand = nil;
				specificArg = "color";
				}
			main:GetModule("CmdBar"):SetupTextbox(commandName, props)
			
			--Final result
			local fr = frame.FinalResult
			local frFrame = fr.Frame
			local example = frFrame.Example
			local serverInvocationFunction = function()
				local displayFrom = false
				if selectedToggles["AG DisplayFrom"] == "Enabled" then
					displayFrom = true
				end
				local data = main.signals.RetrieveBroadcastData:InvokeServer{["Title"] = titleTextBox.Text, ["DisplayFrom"] = displayFrom, ["Color"] = colorTextBox.Text, ["Message"] = messageTextBox.Text}
				return data
			end
			local retrievedDataFunction = function(data)
				example.Title.Text = data.Title
				local displayFrom = data.DisplayFrom
				example.Pic.Visible = displayFrom
				example.SubTitle.Visible = displayFrom
				if displayFrom then
					example.Pic.Image = module:GetUserImage(data.SenderId)
					example.SubTitle.Text = "From ".. data.SenderName
				end
				example.Desc.TextColor3 = Color3.new(data.Color[1], data.Color[2], data.Color[3])
				example.Desc.Text = data.Message
				fr.Visible = true
			end
			local broadcastFunction = function()
				main.signals.ExecuteBroadcast:InvokeServer()
			end
			setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
			
		
		
		
		-------------- << MENU TYPE 8 (alert) >> --------------
		elseif menuType == 8 then
			local title = menuDetails[1]
			local message = menuDetails[2]
			local mute = dragBar.Mute
			local muteLabel = mute.TextLabel
			local soundPlayingIcon = "🔊"
			local soundMutedIcon = "🔇"
			local sound = Instance.new("Sound")
			sound.SoundId = "rbxassetid://"..main.pdata.AlertSoundId
			sound.Volume = main.pdata.AlertVolume
			sound.Pitch = main.pdata.AlertPitch
			sound.Looped = true
			sound.Parent = frame
			sound:Play()
			dragBar.Title.Text = title
			mainFrame.MessageFrame.Message.Text = message
			mute.MouseButton1Down:Connect(function()
				if muteLabel.Text == soundPlayingIcon then
					muteLabel.Text = soundMutedIcon
					sound:Pause()
				else
					muteLabel.Text = soundPlayingIcon
					sound:Play()
				end
			end)	
			
		
		
		-------------- << MENU TYPE 9 (pollMenu) >> --------------
		elseif menuType == 9 then
			local scrollFrame = mainFrame.ScrollFrame
			local defaultToggles = {["AC Server"] = "Current", ["AG ShowResultsTo"] = "You"}
			local selectedToggles = {}
			local targetPlayerLabel = scrollFrame["AD Target Player"]
			local playerSearchFrame = targetPlayerLabel.SearchFrame
			local playerTextBox = playerSearchFrame.TextBox
			local playerValue = menuDetails.targetPlayer
			local firstLabel = scrollFrame["AA Space"]
			local finalLabel = scrollFrame["AZ Space"]
			local loadingButton = scrollFrame["AZ Loading"]
			local submitButton = scrollFrame["AX Submit"]
			local questionTextBox = scrollFrame["AP Question"].SearchFrame.TextBox
			local finalFunction = function(b, toggleName, selectFrame)
				local selectFrameName = selectFrame.Name
				if b.Name == toggleName then
					b.BackgroundTransparency = 0.1
					b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
					selectedToggles[selectFrame.Name] = toggleName
					if selectFrameName == "AC Server" then
						if b.Name == "Current" then
							targetPlayerLabel.Visible = true
						else
							targetPlayerLabel.Visible = false
						end
					end
				else
					b.BackgroundTransparency = 0.8
					b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
				end
			end
			local organisedVariables = {defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel}
			local setupFunction = function(selectFrame)
				if selectFrame.Name == "AC Server" then
					selectToggle(selectFrame, menuDetails.server, organisedVariables)
				elseif defaultToggles[selectFrame.Name] then
					selectToggle(selectFrame, defaultToggles[selectFrame.Name], organisedVariables)
				end
			end
			setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, nil, playerValue)
			local props = {
				maxSuggestions = 3;
				mainParent = mainFrame.Parent;
				textBox = playerTextBox;
				rframe = playerSearchFrame.ResultsFrame;
				suggestionPos = 1;
				suggestionDisplayed = 0;
				forceExecute = false;
				highlightColor = Color3.fromRGB(50,50,50);
				otherColor = Color3.fromRGB(80,80,80);
				suggestionLabels = {};
				currentBarCommand = nil;
				specificArg = "player";
				}
			main:GetModule("CmdBar"):SetupTextbox(commandName, props)
			local defaultQuestion = menuDetails.question
			if defaultQuestion and defaultQuestion ~= "" and defaultQuestion ~= " " then
				questionTextBox.Text = defaultQuestion
			end
			--Answers
			local answersLimit = 10
			local answerTemplate = scrollFrame["AS Answer"]
			local addAnswer = scrollFrame["AT AddAnswer"]
			local answerBoxes = {}
			answerTemplate.Visible = false
			local function removeAnswerBox(box)
				for i,v in pairs(answerBoxes) do
					if v == box then
						table.remove(answerBoxes, i)
						break
					end
				end
				box:Destroy()
				updateCanvasSize(scrollFrame, finalLabel, firstLabel)
			end
			local function createAnswerBox()
				local newBox = answerTemplate:Clone()
				newBox.Visible = true
				newBox.Parent = scrollFrame
				newBox.RemoveBox.MouseButton1Down:Connect(function()
					removeAnswerBox(newBox)
				end)
				table.insert(answerBoxes, newBox)
				updateCanvasSize(scrollFrame, finalLabel, firstLabel)
				return newBox
			end
			local defaultAnswers = menuDetails.answers
			if type(defaultAnswers) == "table" then
				for i, answer in pairs(defaultAnswers) do
					if answer and answer ~= "" and answer ~= " " then
						local box = createAnswerBox()
						box.SearchFrame.TextBox.Text = answer
						if #answerBoxes >= answersLimit then
							break
						end
					end
				end
			end
			addAnswer.Add.MouseButton1Down:Connect(function()
				if #answerBoxes >= answersLimit then
					main:GetModule("Notices"):Notice("Error", main.hdAdminCoreName, "Cannot exceed "..answersLimit.." answers!")
				else
					local box = createAnswerBox()
					scrollFrame.CanvasPosition = Vector2.new(0, scrollFrame.CanvasPosition.Y + box.AbsoluteSize.Y)
				end
			end)
			--VoteTime
			local voteTimeLabel = scrollFrame["AC VoteTime"]
			local voteTimeTextBox = voteTimeLabel.SearchFrame.TextBox
			local originalVoteTime = voteTimeTextBox.Text
			voteTimeTextBox.FocusLost:connect(function(property)
				local newNumber = tonumber(voteTimeTextBox.Text)
				if newNumber then
					if newNumber < 1 then
						newNumber = 1
					elseif newNumber > 60 then
						newNumber = 60
					end
				else
					newNumber = originalVoteTime
				end
				voteTimeTextBox.Text = newNumber
				originalVoteTime = newNumber
			end)
			--
			spawn(function()
				wait(0.1)
				updateCanvasSize(scrollFrame, finalLabel, firstLabel)
			end)
			
			--Final result
			local fr = frame.FinalResult
			local frFrame = fr.Frame
			local example = frFrame.Example
			local serverInvocationFunction = function()
				local voteTime = voteTimeTextBox.Text
				local question = questionTextBox.Text
				local server = selectedToggles["AC Server"]
				local showResultsTo = selectedToggles["AG ShowResultsTo"]
				local playerArg = playerTextBox.Text:gsub(" ", function(c) return "" end)
				local answers = {}
				for i,v in pairs(answerBoxes) do
					table.insert(answers, v.SearchFrame.TextBox.Text)
				end
				--
				local data = main.signals.RetrievePollData:InvokeServer{["VoteTime"] = voteTime, ["Question"] = question, ["Answers"] = answers, ["Server"] = server, ["ShowResultsTo"] = showResultsTo, ["PlayerArg"] = playerArg}
				--
				return data
			end
			local retrievedDataFunction = function(data)
				setupPollResults(example, data)
				fr.Visible = true--]]
			end
			local broadcastFunction = function()
				main.signals.ExecutePoll:InvokeServer()
			end
			setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
			
		
		
		
		-------------- << MENU TYPE 10 (pollSelection) >> --------------
		elseif menuType == 10 then
			main.audio.Notice:Play()
			local scrollFrame = mainFrame.ScrollFrame
			local questionLabel = scrollFrame.Question.TextLabel
			local titleLabel = dragBar.Title
			local data = menuDetails
			local voteTime = data.VoteTime
			local voteTimePlusOne = voteTime+1
			setupPollResults(scrollFrame, data)
			questionLabel.Text = data.Question
			coroutine.wrap(function()
				for i = 1, voteTime do
					titleLabel.Text = string.upper(data.SenderName).."'S POLL (".. voteTimePlusOne-i..")"
					wait(1)
				end
				module:DestroyCommandMenuFrame(frame)
			end)()
			
			
		
		-------------- << MENU TYPE 10 (pollSelection) >> --------------
		elseif menuType == 11 then
			main.audio.Notice:Play()
			local barColors = main:GetModule("cf"):RandomiseTable{
				Color3.fromRGB(220, 30, 30);
				Color3.fromRGB(220, 93, 29);
				Color3.fromRGB(188, 161, 23);
				Color3.fromRGB(107, 186, 22);
				Color3.fromRGB(19, 179, 46);
				Color3.fromRGB(20, 197, 197);
				Color3.fromRGB(24, 120, 255);
				Color3.fromRGB(101, 24, 255);
				Color3.fromRGB(217, 24, 255);
				Color3.fromRGB(255, 24, 128);
			}
			local scrollFrame = mainFrame.ScrollFrame
			local questionLabel = scrollFrame.Question.TextLabel
			local titleLabel = dragBar.Title
			local data = menuDetails
			questionLabel.Text = data.Question
			local resultTemplate = scrollFrame.ResultTemplate
			resultTemplate.Visible = false
			local totalResults = #data.Results
			for i,result in pairs(data.Results) do
				local answerButton = resultTemplate:Clone()
				answerButton.Visible = true
				answerButton.Name = "Answer"..i
				answerButton.Bar.BackgroundColor3 = barColors[i] --Color3.fromHSV(i/10, 1, 1)
				local resultTextStart = i..". "..result.Answer.." ("
				if i == totalResults then
					resultTextStart = result.Answer.." ("
					answerButton.Bar.BackgroundColor3 = Color3.fromRGB(175, 175, 175)
				end
				answerButton.TextLabel.Text = resultTextStart.."0)"
				answerButton.BackgroundColor3 = module:GetLabelBackgroundColor(i)
				answerButton.Bar.Size = UDim2.new(0, 0, 1, 0)
				delay((i-1)/10, function()
					local tweenTime = 2
					local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quart)
					local intValue = Instance.new("IntValue")
					intValue.Value = 0
					main.tweenService:Create(answerButton.Bar, tweenInfo, {Size = UDim2.new(result.Percentage, 0, 1, 0)}):Play()
					main.tweenService:Create(intValue, tweenInfo, {Value = result.Votes}):Play()
					intValue.Changed:Connect(function(newVal)
						answerButton.TextLabel.Text = resultTextStart..newVal..")"
					end)
					wait(tweenTime)
					intValue:Destroy()
				end)
				answerButton.Parent = scrollFrame
			end
			spawn(function()
				wait(0.1)
				updateCanvasSize(scrollFrame, scrollFrame["Answer"..#data.Answers], scrollFrame.Question)
			end)
			
			
			
		
		-------------- << MENU TYPE 12 (globalAlert) >> --------------
		elseif menuType == 12 then
			local scrollFrame = mainFrame.ScrollFrame
			local defaultToggles = {["AC Server"] = "Current"}
			local selectedToggles = {}
			local targetPlayerLabel = scrollFrame["AD Target Player"]
			local playerSearchFrame = targetPlayerLabel.SearchFrame
			local playerTextBox = playerSearchFrame.TextBox
			local playerValue = menuDetails.targetPlayer
			local firstLabel = scrollFrame["AA Space"]
			local finalLabel = scrollFrame["AZ Space"]
			local spaceX = scrollFrame["AX Space"]
			local loadingButton = scrollFrame["AZ Loading"]
			local submitButton = scrollFrame["AX Submit"]
			local titleTextBox = scrollFrame["AG MessageTitle"].SearchFrame.TextBox
			local messageTextBox = scrollFrame["AM Message"].SearchFrame.TextBox
			local finalFunction = function(b, toggleName, selectFrame)
				local selectFrameName = selectFrame.Name
				if b.Name == toggleName then
					b.BackgroundTransparency = 0.1
					b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
					selectedToggles[selectFrame.Name] = toggleName
					if selectFrameName == "AC Server" then
						if b.Name == "Current" then
							targetPlayerLabel.Visible = true
							spaceX.Visible = false
						else
							targetPlayerLabel.Visible = false
							spaceX.Visible = true
						end
					end
				else
					b.BackgroundTransparency = 0.8
					b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
				end
			end
			local organisedVariables = {defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel}
			local setupFunction = function(selectFrame)
				if selectFrame.Name == "AC Server" then
					selectToggle(selectFrame, menuDetails.server, organisedVariables)
				elseif defaultToggles[selectFrame.Name] then
					selectToggle(selectFrame, defaultToggles[selectFrame.Name], organisedVariables)
				end
			end
			setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, nil, playerValue)
			local props = {
				maxSuggestions = 3;
				mainParent = mainFrame.Parent;
				textBox = playerTextBox;
				rframe = playerSearchFrame.ResultsFrame;
				suggestionPos = 1;
				suggestionDisplayed = 0;
				forceExecute = false;
				highlightColor = Color3.fromRGB(50,50,50);
				otherColor = Color3.fromRGB(80,80,80);
				suggestionLabels = {};
				currentBarCommand = nil;
				specificArg = "player";
				}
			main:GetModule("CmdBar"):SetupTextbox(commandName, props)
			local defaultMessage = menuDetails.message
			if defaultMessage and defaultMessage ~= "" and defaultMessage ~= " " then
				messageTextBox.Text = defaultMessage
			end
			titleTextBox.Text = "Alert from ".. main.player.Name
			
			--Final result
			local fr = frame.FinalResult
			local frFrame = fr.Frame
			local example = frFrame.Example
			local serverInvocationFunction = function()
				local title = titleTextBox.Text
				local message = messageTextBox.Text
				local server = selectedToggles["AC Server"]
				local playerArg = playerTextBox.Text:gsub(" ", function(c) return "" end)
				--
				local data = main.signals.RetrieveAlertData:InvokeServer{
					["Title"] = title,
					["Message"] = message,
					["Server"] = server,
					["PlayerArg"] = playerArg
					}
				--
				return data
			end
			local retrievedDataFunction = function(data)
				example.Title.Text = data.Title
				example.Message.Text = data.Message
				fr.Visible = true
			end
			local broadcastFunction = function()
				main.signals.ExecuteAlert:InvokeServer()
			end
			setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
			
		
		
		
			
		end
		--
		setupOriginalZIndex(frame, forceOnTop)
		table.insert(main.commandMenus, frame)
		updateZIndex(main.commandMenus)
		--
	end
	frame.Parent = main.gui
	frame.Visible = true
end

function module:GetMousePoint(hitPosition)
	local rayMag1 = main.camera:ScreenPointToRay(main.lastHitPosition.X, main.lastHitPosition.Y)
	local newRay = Ray.new(rayMag1.Origin, rayMag1.Direction * 100)
	local hit, position = workspace:FindPartOnRay(newRay, main.player.Character)
	return hit, position
end

function module:GetLabelBackgroundColor(i)
	if i%2 == 0 then
		return(Color3.fromRGB(50, 50, 50))
	else
		return(Color3.fromRGB(40, 40, 40))
	end
end

function module:GenerateTagFromId(ID)
	local values = main.alphabet
	local totalValues = #values
	local loops2 = math.ceil(ID/#values)
	local loops3 = math.ceil(ID/(#values)^2)
	local v1 = values[ID%totalValues] or values[totalValues]
	local v2 = values[loops2%totalValues] or values[totalValues]
	local v3 = values[loops3%totalValues] or values[totalValues]
	return v3..v2..v1
end

function module:ClearPage(page)
	for _,label in pairs(page:GetChildren()) do
		if label.Name ~= "UIListLayout" and string.sub(label.Name,1,8) ~= "Template" then
			label:Destroy()
		elseif label:IsA("Frame") then
			label.Visible = false
		end
	end
end

function module:UpdateClientData()
	main.pdata = main.rfunction:InvokeServer("RetrievePlayerData")
end



