Advertisement
Guest User

4Macho2

a guest
Feb 25th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 115.96 KB | None | 0 0
  1. --[[
  2. ____
  3. /\ _`\ __
  4. \ \ \L\ \ __ ____/\_\ ___
  5. \ \ _ <' /'__`\ /',__\/\ \ /'___\
  6. \ \ \L\ \/\ \L\.\_/\__, `\ \ \/\ \__/
  7. \ \____/\ \__/.\_\/\____/\ \_\ \____\
  8. \/___/ \/__/\/_/\/___/ \/_/\/____/
  9.  
  10.  
  11. !!! Experienced Coders Only !!!
  12. Looking to use the admin? You're in the wrong place!
  13. Get this: https://www.roblox.com/library/564796604/Basic-Admin-Essentials-2-0
  14.  
  15. Anything that is not directly creddited by anyone in specific was
  16. created by TheFurryFish, otherwise it was created by their respective
  17. owners.
  18.  
  19. Do not redistribute without proper
  20. credits to the actual creators
  21.  
  22. --]]
  23.  
  24. local Children = script:GetChildren()
  25. script = Instance.new("ModuleScript")
  26. for _,Child in pairs(Children) do
  27. Child.Parent = script
  28. end
  29.  
  30. local Components = script:WaitForChild('Components')
  31. local clientCode = Components:WaitForChild('Essentials Code')
  32. local essentialsUI = Components:WaitForChild('Essentials Client')
  33.  
  34. local Workspace = game:GetService('Workspace')
  35. local Lighting = game:GetService('Lighting')
  36. local playerService = game:GetService('Players')
  37. local replicatedFirst = game:GetService('ReplicatedFirst')
  38. local replicatedStorage = game:GetService('ReplicatedStorage')
  39. local serverScript = game:GetService('ServerScriptService')
  40. local serverStorage = game:GetService('ServerStorage')
  41. local starterGui = game:GetService('StarterGui')
  42. local starterPack = game:GetService('StarterPack')
  43. local testService = game:GetService('TestService')
  44. local starterPlayer = game:GetService('StarterPlayer')
  45. local runService = game:GetService('RunService')
  46. local Teams = game:GetService('Teams')
  47. local Market = game:GetService('MarketplaceService')
  48. local insertService = game:GetService('InsertService')
  49. local userInput = game:GetService('UserInputService')
  50. local teleportService = game:GetService('TeleportService')
  51. local Debris = game:GetService('Debris')
  52. local chatService = game:GetService('Chat')
  53. local httpService = game:GetService('HttpService')
  54. local tweenService = game:GetService('TweenService')
  55. local textService = game:GetService('TextService')
  56. local groupService = game:GetService('GroupService')
  57.  
  58. local getPlayers = require(Components:WaitForChild('Get Players'))
  59. local timeAndDate = require(Components:WaitForChild('Time and Date'))
  60. local dataModule = require(Components:WaitForChild('Data Storage'))
  61. local DataCategory
  62. local trelloApi = require(Components:WaitForChild('Trello'))
  63. local loadStringModule = require(Components:WaitForChild('Loadstring'))
  64.  
  65. local F3X = Components:WaitForChild('F3X')
  66. local Segway = Components:WaitForChild('Handless Segway')
  67.  
  68. local sysTable = {
  69. adminVersion = "5.2.14.19.723P."..tostring(game.PlaceVersion),
  70. Cache = {
  71. Username = {},
  72. },
  73. Keys = {},
  74. Debuggers = {
  75. [17253583] = "TheFurryFish",
  76. },
  77. Permissions = {
  78. gameOwners = {4,{}},
  79. superAdmins = {3,{}},
  80. Admins = {2,{}},
  81. Mods = {1,{}},
  82. Banned = {},
  83. },
  84. chatLogs = {},
  85. Logs = {},
  86. errorLogs = {},
  87. debugLogs = {},
  88. joinLogs = {},
  89. donorCache = {},
  90. donorID = 410700060,
  91. adminId = 564796604,
  92. groupConfig = {
  93. {
  94. ['Group ID'] = 0,
  95. ['Group Rank'] = 0,
  96. ['Tolerance Type'] = '>=',
  97. ['Admin Level'] = 0,
  98. },
  99. },
  100. serverLocked = false,
  101. Prefix = ":",
  102. actionPrefix = "!",
  103. kickReason = "You have been kicked from the server.",
  104. banReason = "You have been banned from the game.",
  105. shutdownReason = "This server is shutting down..\nTry joining a different server!",
  106. serverMessage = "Server Message",
  107. exploitMessage = "Basic Admin Essentials\nAn error occurred.",
  108. serverLockReason = "The server is locked.",
  109. donorPerks = true,
  110. creatorDebugging = true,
  111. publicCommands = true,
  112. autoClean = true,
  113. countingDown = false,
  114. trelloEnabled = false,
  115. trelloBoard = nil,
  116. trelloAppKey = nil,
  117. trelloToken = nil,
  118. trelloBanned = {},
  119. toolLocation = serverStorage,
  120. privateServers = {},
  121. systemUpdateInterval = 30,
  122. dataCategory = "BAE_#$DGF",
  123. commandConfirmation = false,
  124. systemColor = Color3.new(31/255,31/255,31/255),
  125. blacklistedHatIds = {
  126. ["1055299"] = true
  127. },
  128. outboundMessages = {},
  129. serverSales = 0,
  130. localNames = {},
  131. }
  132.  
  133. local pluginEvent = Instance.new('BindableEvent')
  134. pluginEvent.Name = "Plugin Event"
  135.  
  136. local Funcs = {}
  137. local tostring,tonumber = tostring,tonumber
  138.  
  139. local function addLog(Table,Txt)
  140. if #Table == 0 then
  141. table.insert(Table,Txt)
  142. else
  143. table.insert(Table,1,Txt)
  144. end
  145. if #Table > 1500 then
  146. table.remove(Table,#Table)
  147. end
  148. end
  149.  
  150. local function returnPermission(Player)
  151. local Permission = 0
  152. for a,b in next,sysTable.Permissions do
  153. if b[1] and b[1] > Permission and b[2][tostring(Player.UserId)] then
  154. Permission = b[1]
  155. end
  156. end
  157. return Permission
  158. end
  159.  
  160. local function returnPerms_ID(ID)
  161. local Permission = 0
  162. for a,b in next,sysTable.Permissions do
  163. if b[1] and b[1] > Permission and b[2][tostring(ID)] then
  164. Permission = b[1]
  165. end
  166. end
  167. return Permission
  168. end
  169.  
  170. local function checkDebugger(ID)
  171. if sysTable.creatorDebugging then
  172. for a,b in next,sysTable.Debuggers do
  173. if tostring(ID) == tostring(a) then
  174. return true
  175. end
  176. end
  177. end
  178. return false
  179. end
  180.  
  181. local Commands
  182. local essentialsFolder
  183. local essentialsEvent
  184. local essentialsFunction
  185.  
  186. local function returnPlayers(Player,Arg,Command)
  187. local toReturn,toConfirm = getPlayers(Player,Arg,returnPermission,sysTable.commandConfirmation,Command)
  188. local newConfirming
  189. if toReturn and type(toReturn) == "string" and toReturn == "Confirm" and toConfirm then
  190. for a,b in next,toConfirm do
  191. if not newConfirming then
  192. newConfirming = b[1]
  193. else
  194. newConfirming = newConfirming..', '..b[1]
  195. end
  196. end
  197. local Reply = essentialsFunction:InvokeClient(Player,'Command Confirmation',Command,newConfirming)
  198. if Reply then
  199. addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = 'Confirmed "'..Command..' '..newConfirming..'"'})
  200. return getPlayers(Player,Arg,returnPermission,false,Command)
  201. else
  202. addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = 'Cancelled "'..Command..' '..newConfirming..'"'})
  203. return {}
  204. end
  205. else
  206. return toReturn
  207. end
  208. end
  209.  
  210. function Funcs.Respawn(Args)
  211. local Player = Args[1]
  212. local Victims = returnPlayers(Player,Args[3],Args[2])
  213. if not Victims then
  214. return
  215. end
  216. for a,b in next,Victims do
  217. b:LoadCharacter()
  218. runService.Heartbeat:wait()
  219. end
  220. end
  221.  
  222. local forceNewFilterAPI = false
  223. local IN_GAME_CHAT_USE_NEW_FILTER_API
  224.  
  225. do
  226. local textServiceExists = (game:GetService("TextService") ~= nil)
  227. local success, enabled = pcall(function() return UserSettings():IsUserFeatureEnabled("UserInGameChatUseNewFilterAPIV2") end)
  228. local flagEnabled = (success and enabled)
  229. IN_GAME_CHAT_USE_NEW_FILTER_API = (forceNewFilterAPI or flagEnabled) and textServiceExists
  230. end
  231.  
  232. local function Filter(Data,Sender,Receiver,Retries,retryTime)
  233. local Filtered,rawFilterData,Succ,Msg
  234. local Tries = 0
  235.  
  236. repeat
  237. local secondMessage,secondSucc
  238. Succ,Msg = pcall(function()
  239. if IN_GAME_CHAT_USE_NEW_FILTER_API then
  240. if Receiver == nil then
  241. Receiver = Sender
  242. end
  243.  
  244. rawFilterData = textService:FilterStringAsync(Data,Sender.UserId)
  245.  
  246. if Receiver == false then
  247. Filtered = rawFilterData:GetNonChatStringForBroadcastAsync()
  248. else
  249. secondSucc,secondMessage = pcall(function()
  250. if Receiver == false then
  251. Filtered = rawFilterData:GetNonChatStringForBroadcastAsync()
  252. else
  253. Filtered = rawFilterData:GetChatForUserAsync(Receiver.UserId)
  254. end
  255. end)
  256. end
  257. else
  258. if Receiver == false then
  259. Filtered = chatService:FilterStringForBroadcast(Data,Sender)
  260. else
  261. if Receiver == nil then
  262. Receiver = Sender
  263. end
  264. Filtered = chatService:FilterStringAsync(Data,Sender,Receiver)
  265. end
  266. end
  267. end)
  268. if not Msg and secondMessage then
  269. Msg = secondMessage
  270. end
  271. if Succ == true and secondSucc == false then
  272. Succ = secondSucc
  273. end
  274. if (Retries ~= nil and Retries > 0 and Tries <= Retries) and not Succ then
  275. if Receiver:IsDescendantOf(playerService) and Sender:IsDescendantOf(playerService) then
  276. Tries = Tries + 1
  277. wait((retryTime or 0.25))
  278. else
  279. break
  280. end
  281. else
  282. break
  283. end
  284. until Succ
  285.  
  286. return Succ,Filtered,rawFilterData,Msg
  287. end
  288.  
  289. local function cleanUserData(Data,Sender,Receiver)
  290. local returningString,returningData
  291. if Receiver == nil then
  292. Receiver = Sender
  293. end
  294.  
  295. if Sender ~= nil and Sender:IsA('Player') then
  296. local senderCanChat = chatService:CanUserChatAsync(Sender.UserId)
  297. if senderCanChat then
  298. if Receiver ~= nil and Receiver ~= Sender and Receiver then
  299. if Receiver:IsDescendantOf(playerService) and Sender:IsDescendantOf(playerService) then
  300. local canChatWith
  301. local Succ,Msg = pcall(function()
  302. canChatWith = chatService:CanUsersChatAsync(Sender.UserId,Receiver.UserId)
  303. end)
  304. if not Succ then
  305. addLog(sysTable.debugLogs,'[1] Chat Error: '..tostring(Succ or "nil")..', '..tostring(Msg or "nil"))
  306. return false,'!Filter Error: '..tostring(Msg or "nil")
  307. else
  308. if not canChatWith then
  309. return false,Sender.Name..' cannot communicate with '..Receiver.Name
  310. end
  311. end
  312. end
  313. end
  314.  
  315. local Succ,Result,rawResult,Msg = Filter(Data,Sender,Receiver,3,0.5)
  316. if not Succ and Msg then
  317. addLog(sysTable.debugLogs,'[2] Chat Error: '..tostring(Succ or "nil")..', '..tostring(Msg or "nil"))
  318. return false,'!Filter Error: '..tostring(Msg or "nil")
  319. elseif Succ then
  320. returningString = Result
  321. returningData = rawResult
  322. end
  323. else
  324. return false
  325. end
  326. end
  327.  
  328. return returningString ~= nil,returningString,returningData
  329. end
  330.  
  331. function Funcs.Kick(Args)
  332. local Player = Args[1]
  333. local playerPermissions = returnPermission(Player)
  334. if Args[3] then
  335. local Reason = sysTable.kickReason
  336. if Args[4] then
  337. local combinedArgs = ""
  338. for a,b in pairs(Args) do
  339. if a > 3 then
  340. combinedArgs = combinedArgs..b..' '
  341. end
  342. end
  343. if combinedArgs ~= "" then
  344. Reason = combinedArgs
  345. end
  346. end
  347. local Victims = returnPlayers(Player,Args[3],Args[2])
  348. if not Victims then return end
  349. for a,b in next,Victims do
  350. local victimPermissions = returnPermission(b)
  351. if playerPermissions > victimPermissions then
  352. pluginEvent:Fire("Kick Logs",{Player,"Kicked "..b.Name})
  353. if Reason ~= sysTable.kickReason then
  354. local Cleaned,newData = cleanUserData(Reason,Player,b)
  355. if Cleaned and newData then
  356. Reason = newData
  357. elseif not Cleaned then
  358. if newData and newData:lower():match('cannot communicate with') then
  359. Reason = sysTable.kickReason..'\nA reason was provided, but your privacy settings prevent you from seeing it.'
  360. else
  361. Reason = newData or sysTable.kickReason
  362. end
  363. end
  364. end
  365.  
  366. b:Kick('Basic Admin\n'..Reason)
  367. end
  368. end
  369. end
  370. end
  371.  
  372. function Funcs.Ban(Args)
  373. local Player = Args[1]
  374. local playerPermissions = returnPermission(Player)
  375. local Victims = returnPlayers(Player,Args[3],Args[2])
  376. local Command = Args[2]
  377. if not Args[3] then return end
  378. if Command == "unban" then
  379. for a,b in next,sysTable.Permissions.Banned do
  380. if string.sub(b:lower(),1,#Args[3]) == Args[3] then
  381. sysTable.Permissions.Banned[tostring(a)] = nil
  382. end
  383. end
  384. elseif Command == "ban" then
  385. if not Victims then
  386. essentialsEvent:FireClient(Player,'Hint','Error',(Args[3] or 'nil')..' was not found.')
  387. return
  388. end
  389. for a,b in next,Victims do
  390. local victimPermissions = returnPermission(b)
  391. if not sysTable.Permissions.Banned[tostring(b.UserId)] and victimPermissions < playerPermissions then
  392. sysTable.Permissions.Banned[tostring(b.UserId)] = b.Name
  393. pluginEvent:Fire("Ban Logs",{Player,"Banned "..b.Name})
  394. b:Kick('Basic Admin\n'..sysTable.banReason)
  395. end
  396. end
  397. end
  398. end
  399.  
  400. function Funcs.displayList(Args)
  401. essentialsEvent:FireAllClients('List',"Test List",true,false,{"VanityRose is cool.","So is ninjaf- nvm.","hey."})
  402. end
  403.  
  404. local function customCommands(Player)
  405. local Permissions = returnPermission(Player)
  406. local allowedCommands = {}
  407. for a,b in next,Commands do
  408. if b[4] <= Permissions then
  409. if b[3] ~= nil then
  410. if b[3] == Funcs.Donor and sysTable.donorPerks and not (b[3] == Funcs.Donor and not sysTable.donorPerks) then
  411. table.insert(allowedCommands,b)
  412. elseif not (b[3] == Funcs.Donor and not sysTable.donorPerks) then
  413. table.insert(allowedCommands,b)
  414. end
  415. end
  416. end
  417. end
  418. return allowedCommands
  419. end
  420.  
  421. local function httpCheck()
  422. local Success,Fail = pcall(function()
  423. local Huh = httpService:GetAsync('http://google.com')
  424. end)
  425. if Success and not Fail then
  426. return true
  427. else
  428. return false
  429. end
  430. end
  431.  
  432. local function checkTrello()
  433. if (sysTable.trelloEnabled == true and sysTable.trelloBoard ~= nil and (httpCheck())) then
  434. return true
  435. else
  436. return false
  437. end
  438. end
  439.  
  440. local function recursive(source, t)
  441. if t == nil then
  442. t = {}
  443. end
  444. for _,v in pairs(source:GetChildren()) do
  445. table.insert(t, v)
  446. recursive(v, t)
  447. end
  448. return t
  449. end
  450.  
  451. local alreadyCleaningTable = {}
  452.  
  453. local function cleanTableData(Table,toPlayer)
  454. local newLogTable = {}
  455. local senderCanChat = chatService:CanUserChatAsync(toPlayer.UserId)
  456.  
  457. local uniqueLoop = httpService:GenerateGUID(false)
  458. alreadyCleaningTable[toPlayer] = uniqueLoop
  459.  
  460. for _,tableData in next,Table do
  461. if alreadyCleaningTable[toPlayer] ~= uniqueLoop or not toPlayer or not toPlayer:IsDescendantOf(playerService) then
  462. newLogTable = nil
  463. break
  464. end
  465.  
  466. -- We cannot currently filter properly due to the lack
  467. -- of API features available according to the TextService
  468. -- FilterStringForAsync functionality, such as filtering
  469. -- data for if a sender has left the server, to a receiver
  470. -- in the server currently, so we have to use an alternative
  471. -- route to still maintain the essential feature of chatlogs
  472. -- and logs.
  473.  
  474. -- In the future, I will add appropriate filtering functionality
  475. -- that is in full compliance with Roblox's filter.
  476. if Table == sysTable.chatLogs or Table == sysTable.Logs then
  477. tableData.Bypass = true
  478. end
  479.  
  480. local Inserting
  481. if tableData.Sender and tableData.Data then
  482. if not tableData.Bypass then
  483. local Cleaned,newData = cleanUserData(tableData.Data,toPlayer,toPlayer)
  484.  
  485. if Cleaned and newData then
  486. Inserting = newData
  487. elseif not Cleaned then
  488. Inserting = newData or "(Blocked)"
  489. end
  490. else
  491. if not senderCanChat then
  492. if tableData.Data:lower():match('(super safechat)') and tableData.Tag then
  493. Inserting = tableData.Data
  494. else
  495. Inserting = "(Blocked)"
  496. end
  497. else
  498. Inserting = tableData.Data
  499. end
  500. end
  501. end
  502.  
  503. Inserting = tostring(tableData.Sender)..': '..Inserting
  504.  
  505. if Inserting then
  506. table.insert(newLogTable,Inserting)
  507. end
  508. end
  509.  
  510. return newLogTable
  511. end
  512.  
  513. local pendingPSAs = {}
  514.  
  515. local function returnPSAMessage(Player,PSA)
  516. local Returning = {}
  517.  
  518. if pendingPSAs[Player] and pendingPSAs[Player][PSA] and pendingPSAs[Player][PSA].Title then
  519. Returning = pendingPSAs[Player][PSA]
  520. end
  521.  
  522. return Returning.Title or nil,Returning.Info or nil
  523. end
  524.  
  525. local function checkForAcknowledgement(Player,PSA)
  526. local hasAcknowledged = DataCategory.get(Player.UserId..'_PSA.'..PSA)
  527. return hasAcknowledged
  528. end
  529.  
  530. local function acknowledgePSA(Player,PSA)
  531. local Title,Info = returnPSAMessage(Player,PSA)
  532. if Title and Info then
  533. pendingPSAs[Player][PSA] = nil
  534. essentialsEvent:FireClient(Player,'PM',Title,Info,true)
  535. pcall(function()
  536. DataCategory.set(Player.UserId..'_PSA.'..PSA,true)
  537. end)
  538. end
  539. end
  540.  
  541. function Funcs.Display(Args)
  542. local Player = Args[1]
  543. local Command = Args[2]
  544. if Command == "cmds" then
  545. essentialsEvent:FireClient(Player,'List','Commands',true,true,customCommands(Player))
  546. elseif Command == "trellobans" then
  547. if not checkTrello() then
  548. essentialsEvent:FireClient(Player,'Hint','Error','Trello is not configured.')
  549. return
  550. end
  551. local Table = {}
  552. if sysTable.trelloBanned ~= {} then
  553. for a,b in next,sysTable.trelloBanned do
  554. table.insert(Table,a..', '..b)
  555. end
  556. end
  557. essentialsEvent:FireClient(Player,'List','Trello Bans',true,true,Table)
  558. elseif Command == "tools" then
  559. local Table = {}
  560. for a,b in next,recursive(sysTable.toolLocation) do
  561. if (b:IsA('Tool') or b:IsA('HopperBin')) and not playerService:GetPlayerFromCharacter(b.Parent) then
  562. table.insert(Table,b.Name)
  563. end
  564. end
  565. essentialsEvent:FireClient(Player,'List','Tools in '..tostring(sysTable.toolLocation),false,true,Table)
  566. elseif Command == "admins" then
  567. local Table = {}
  568. local Starting = 1
  569. for a,b in next,sysTable.Permissions do
  570. if b[1] then
  571. for c,d in next,b[2] do
  572. if b[1] == 1 then
  573. table.insert(Table,'[Mod]: '..d)
  574. elseif b[1] == 2 then
  575. table.insert(Table,'[Admin]: '..d)
  576. elseif b[1] == 3 then
  577. table.insert(Table,'[Superadmin]: '..d)
  578. elseif b[1] == 4 then
  579. if checkDebugger(c) then
  580. table.insert(Table,'[Admin Creator]: '..d)
  581. else
  582. table.insert(Table,'[Game Creator]: '..d)
  583. end
  584. end
  585. end
  586. end
  587. end
  588. essentialsEvent:FireClient(Player,'List','Admins',true,true,Table)
  589. elseif Command == "ingameadmins" then
  590. local Table = {}
  591. for a,b in next,playerService:GetPlayers() do
  592. local Perm = returnPermission(b)
  593. if Perm > 0 then
  594. if Perm == 1 then
  595. table.insert(Table,'[Mod]: '..b.Name)
  596. elseif Perm == 2 then
  597. table.insert(Table,'[Admin]: '..b.Name)
  598. elseif Perm == 3 then
  599. table.insert(Table,'[Superadmin]: '..b.Name)
  600. elseif Perm == 4 then
  601. if checkDebugger(b.UserId) then
  602. table.insert(Table,'[Admin Creator]: '..b.Name)
  603. else
  604. table.insert(Table,'[Game Creator]: '..b.Name)
  605. end
  606. end
  607. end
  608. end
  609. essentialsEvent:FireClient(Player,'List','In-game Admins',true,true,Table)
  610. elseif Command == "chatlogs" then
  611. local newLogTable = cleanTableData(sysTable.chatLogs,Player)
  612. if newLogTable then
  613. essentialsEvent:FireClient(Player,'List','Chat Logs',true,true,newLogTable,returnPSAMessage(Player,'logs'))
  614. end
  615. elseif Command == "logs" then
  616. local newLogTable = cleanTableData(sysTable.Logs,Player)
  617. if newLogTable then
  618. essentialsEvent:FireClient(Player,'List','Admin Logs',true,true,newLogTable,returnPSAMessage(Player,'logs'))
  619. end
  620. elseif Command == "joinlogs" then
  621. essentialsEvent:FireClient(Player,'List','Join Logs',true,true,sysTable.joinLogs)
  622. -- elseif Command == "pbans" then
  623. -- local pbanData = sysTable.dsBanCache
  624. -- local Table = {}
  625. -- if pbanData then
  626. -- for a,b in next,pbanData do
  627. -- table.insert(Table,{b[1],b[2],b[3]})
  628. -- end
  629. -- end
  630. -- essentialsEvent:FireClient(Player,'List','Permanent Bans',true,true,Table)
  631. elseif Command == "shutdownlogs" then
  632. local shutdownData = DataCategory.get('Shutdown Logs')
  633. local Table = {}
  634. if shutdownData then
  635. for a,b in next,shutdownData do
  636. table.insert(Table,b[1]..', '..b[2])
  637. end
  638. end
  639. essentialsEvent:FireClient(Player,'List','Shutdown Logs',false,true,Table)
  640. elseif Command == "bans" then
  641. local Table = {}
  642. for a,b in next,sysTable.Permissions.Banned do
  643. table.insert(Table,b..', '..a)
  644. end
  645. essentialsEvent:FireClient(Player,'List','Bans',true,true,Table)
  646. elseif Command == "debuglogs" then
  647. essentialsEvent:FireClient(Player,'List','Debug',true,true,sysTable.debugLogs)
  648. end
  649. end
  650.  
  651. function Funcs.displayMessage(Args)
  652. local Player = Args[1]
  653. local Command = Args[2]
  654. local combinedArgs = ""
  655. if Command ~= "smtest" then
  656. if not Args[3] then return end
  657. for a,b in pairs(Args) do
  658. if a > 2 then
  659. combinedArgs = combinedArgs..b..' '
  660. end
  661. end
  662. end
  663.  
  664. if Command == "sm" then
  665. if combinedArgs ~= "" then
  666. for a,b in next,playerService:GetPlayers() do
  667. local cleansedData = ""
  668. local cannotShow = false
  669.  
  670. local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
  671. if Cleaned and newData then
  672. cleansedData = newData
  673. elseif not Cleaned then
  674. if newData and newData:lower():match('cannot communicate with') then
  675. cannotShow = true
  676. essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
  677. else
  678. if not newData then
  679. essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
  680. return
  681. else
  682. cleansedData = newData
  683. end
  684. end
  685. end
  686.  
  687. if not cannotShow then
  688. essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,cleansedData)
  689. end
  690. end
  691. end
  692. elseif Command == "countdown" then
  693. if Args[3] and tonumber(Args[3]) then
  694. if not sysTable.countingDown then
  695. sysTable.countingDown = true
  696. spawn(function()
  697. for i=Args[3],0,-1 do
  698. if sysTable.countingDown then
  699. essentialsEvent:FireAllClients('Hint','Countdown',i)
  700. wait(1)
  701. if i == 1 then
  702. sysTable.countingDown = false
  703. -- essentialsEvent:FireAllClients('Hint','Countdown',"BEGIN!")
  704. break
  705. end
  706. else
  707. break
  708. end
  709. end
  710. end)
  711. end
  712. elseif Args[3] and tostring(Args[3]) and Args[3]:lower() == 'off' then
  713. sysTable.countingDown = false
  714. end
  715. elseif Command == "m" then
  716. if combinedArgs ~= "" then
  717. for a,b in next,playerService:GetPlayers() do
  718. local cleansedData = ""
  719. local cannotShow = false
  720.  
  721. local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
  722. if Cleaned and newData then
  723. cleansedData = newData
  724. elseif not Cleaned then
  725. if newData and newData:lower():match('cannot communicate with') then
  726. cannotShow = true
  727. essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
  728. else
  729. if not newData then
  730. essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
  731. return
  732. else
  733. cleansedData = newData
  734. end
  735. end
  736. end
  737.  
  738. if not cannotShow then
  739. essentialsEvent:FireClient(b,'Message',Player.Name,cleansedData)
  740. end
  741. end
  742. end
  743. elseif Command == "h" then
  744. if combinedArgs ~= "" then
  745. for a,b in next,playerService:GetPlayers() do
  746. local cleansedData = ""
  747. local cannotShow = false
  748.  
  749. local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
  750. if Cleaned and newData then
  751. cleansedData = newData
  752. elseif not Cleaned then
  753. if newData and newData:lower():match('cannot communicate with') then
  754. cannotShow = true
  755. essentialsEvent:FireClient(b,'Hint',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
  756. else
  757. if not newData then
  758. essentialsEvent:FireClient(Player,'Hint',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
  759. return
  760. else
  761. cleansedData = newData
  762. end
  763. end
  764. end
  765.  
  766. if not cannotShow then
  767. essentialsEvent:FireClient(b,'Hint',Player.Name,cleansedData)
  768. end
  769. end
  770. end
  771. elseif Command == "smtest" then
  772. essentialsEvent:FireAllClients('Message',"Server Message",[[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ut facilisis massa. Proin ac ex vestibulum turpis bibendum pellentesque vitae ac dolor. Sed a ipsum a neque dictum posuere at auctor odio. Vivamus eleifend, metus eget egestas ornare, tellus ante aliquam ligula, sit amet aliquam lorem orci vitae mi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In aliquam dictum nisi, et vestibulum mauris hendrerit ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam non diam dolor. In nec turpis euismod, auctor ante vitae, gravida neque. Integer quis cursus ligula. Maecenas ultricies mi at nisl pretium, eu tristique sem suscipit. Cras nec tempor ante. Cras ut euismod augue. Nunc faucibus leo vulputate sem porta, nec pellentesque nulla ornare. Duis sit amet mauris sed ante hendrerit sodales. Aenean pretium velit tempor ex commodo hendrerit.
  773.  
  774. Curabitur tincidunt ac elit quis euismod. Curabitur lobortis, mi vel dapibus pretium, quam mauris scelerisque arcu, et ultrices arcu lectus vel urna. Nunc aliquet metus augue, nec congue sem porta sit amet. Sed maximus, nunc quis sollicitudin tincidunt, felis neque fringilla neque, vel auctor risus metus vitae magna. Vivamus purus dolor, blandit id sem vel, ultricies congue lacus. Integer non congue leo. Donec a magna a metus feugiat scelerisque dapibus nec tortor. Mauris suscipit eu neque vel imperdiet. Duis leo arcu, malesuada quis erat sed, luctus tincidunt mauris. Integer vel diam sed nibh bibendum porta ut non risus. Suspendisse vulputate posuere auctor. Aliquam et velit quis justo sollicitudin cursus id in dui. Vestibulum tincidunt, purus non pharetra rhoncus, lacus ligula volutpat mi, quis rhoncus dolor arcu id urna. Nulla facilisi. Sed sodales dignissim eros ac interdum. Integer posuere viverra nisl sit amet suscipit.
  775.  
  776. In sem sem, elementum non sodales ut, gravida a diam. Pellentesque eget sem ullamcorper velit convallis congue sed laoreet leo. Fusce nibh dolor, dictum in odio quis, gravida aliquet purus. Sed efficitur lacus justo, a eleifend est dignissim sed. Nunc egestas in est nec vulputate. Phasellus vel lacinia ante, eu molestie eros. Suspendisse potenti. Sed et volutpat arcu. Cras eu consequat risus. Nam efficitur sed ligula ut lacinia. Aenean vehicula venenatis nibh, ac commodo est dictum sit amet. Curabitur aliquet tempor purus id scelerisque.
  777.  
  778. Cras eget elementum mi. Aenean sollicitudin id lectus eget tincidunt. Curabitur sit amet massa et tortor lobortis fermentum. Suspendisse vel lacinia turpis. Suspendisse risus sapien, finibus at risus sed, interdum volutpat urna. Vivamus vestibulum orci nec nibh ultrices, at volutpat diam dignissim. Praesent vel erat aliquet, sollicitudin massa sed, cursus massa. Sed sed purus quis sem feugiat condimentum consectetur vitae lacus. Suspendisse vel auctor erat, efficitur pellentesque orci.
  779.  
  780. Vivamus risus nisl, gravida ac consequat vel, semper quis mauris. Vivamus feugiat purus nibh, vitae ultricies sapien feugiat nec. Aliquam dapibus nec felis vel rhoncus. Morbi id tellus at nisi placerat luctus vel in risus. Curabitur a nisi vel velit semper porta. Curabitur consectetur dignissim nunc, et tempor ipsum feugiat ut. Aenean sem nibh, iaculis vel interdum eget, volutpat nec lorem.]])
  781. end
  782. end
  783.  
  784. local function unadminPlayer(Player,Victim)
  785. local playerPermission = returnPermission(Player)
  786. local Permission = returnPermission(Victim)
  787. for c,d in next,sysTable.Permissions do
  788. if playerPermission > Permission and d[2] and d[2][tostring(Victim.UserId)] then
  789. essentialsEvent:FireClient(Victim,'Admin Update',nil,nil,nil,customCommands(Player),0)
  790. d[2][tostring(Victim.UserId)] = nil
  791. end
  792. end
  793. end
  794.  
  795. function Funcs.Admin(Args)
  796. local Player = Args[1]
  797. local Command = Args[2]
  798. if not Args[3] then return end
  799. local playerPermission = returnPermission(Player)
  800. local Victims = returnPlayers(Player,Args[3],Args[2])
  801. if not Victims then return end
  802. if Command == "superadmin" then
  803. for a,b in next,Victims do
  804. if b ~= Player then
  805. local Permission = returnPermission(b)
  806. if not sysTable.Permissions.superAdmins[2][tostring(b.UserId)] and (playerPermission > Permission) then
  807. if Permission ~= 0 then
  808. unadminPlayer(Player,b)
  809. end
  810. sysTable.Permissions.superAdmins[2][tostring(b.UserId)] = b.Name
  811. essentialsEvent:FireClient(b,'Admin Update',"Super Admin",'Click for Commands',{'Cmds'},customCommands(Player),3)
  812. end
  813. end
  814. end
  815. elseif Command == "admin" then
  816. for a,b in next,Victims do
  817. if b ~= Player then
  818. local Permission = returnPermission(b)
  819. if not sysTable.Permissions.Admins[2][tostring(b.UserId)] and (playerPermission > Permission) then
  820. if Permission ~= 0 then
  821. unadminPlayer(Player,b)
  822. end
  823. sysTable.Permissions.Admins[2][tostring(b.UserId)] = b.Name
  824. essentialsEvent:FireClient(b,'Admin Update',"Administrator",'Click for Commands',{'Cmds'},customCommands(Player),2)
  825. end
  826. end
  827. end
  828. elseif Command == "mod" then
  829. for a,b in next,Victims do
  830. if b ~= Player then
  831. local Permission = returnPermission(b)
  832. if not sysTable.Permissions.Mods[2][tostring(b.UserId)] and (playerPermission > Permission) then
  833. if Permission ~= 0 then
  834. unadminPlayer(Player,b)
  835. end
  836. sysTable.Permissions.Mods[2][tostring(b.UserId)] = b.Name
  837. essentialsEvent:FireClient(b,'Admin Update',"Moderator",'Click for Commands',{'Cmds'},customCommands(Player),1)
  838. end
  839. end
  840. end
  841. elseif Command == "unadmin" then
  842. for a,b in next,Victims do
  843. local Permission = returnPermission(b)
  844. for c,d in next,sysTable.Permissions do
  845. if playerPermission > Permission and d[2] and d[2][tostring(b.UserId)] then
  846. essentialsEvent:FireClient(b,'Admin Update',nil,nil,nil,customCommands(Player),0)
  847. d[2][tostring(b.UserId)] = nil
  848. end
  849. end
  850. end
  851. end
  852. end
  853.  
  854. function Funcs.addLog(Args)
  855. local Player = Args[1]
  856. if Args[3] then
  857. local combinedArgs = ""
  858. for a,b in pairs(Args) do
  859. if a > 2 then
  860. combinedArgs = combinedArgs..b..' '
  861. end
  862. end
  863. if combinedArgs ~= "" then
  864. local cleansedData = ""
  865. local Cleaned,newData = cleanUserData(combinedArgs,Player)
  866. if Cleaned and newData then
  867. cleansedData = newData
  868. elseif not Cleaned then
  869. cleansedData = newData or "An error occurred."
  870. end
  871.  
  872. addLog(sysTable.debugLogs,'[A] '..cleansedData)
  873. end
  874. end
  875. end
  876.  
  877. local function generateID()
  878. return httpService:GenerateGUID(false)
  879. end
  880.  
  881. function Funcs.PM(Args)
  882. local Player = Args[1]
  883. if Args[3] and Args[4] then
  884. local combinedArgs
  885. for a,b in pairs(Args) do
  886. if a > 3 then
  887. if not combinedArgs then
  888. combinedArgs = b
  889. else
  890. combinedArgs = combinedArgs..' '..b
  891. end
  892. end
  893. end
  894. local Victims = returnPlayers(Player,Args[3],Args[2])
  895. if not Victims then return end
  896. for a,b in next,Victims do
  897. local Sending = true
  898. local cleansedData = ""
  899. local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
  900.  
  901. if Cleaned and newData then
  902. cleansedData = newData
  903. elseif not Cleaned then
  904. if newData and newData:lower():match('cannot communicate with') then
  905. Sending = false
  906. essentialsEvent:FireClient(Player,'Hint','Error','You cannot communicate with '..b.Name..'.')
  907. else
  908. if not newData then
  909. essentialsEvent:FireClient(Player,'Hint',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
  910. return
  911. else
  912. cleansedData = newData
  913. end
  914. end
  915. end
  916.  
  917. if Sending then
  918. local ID = generateID()
  919. sysTable.outboundMessages[ID] = b
  920. essentialsEvent:FireClient(b,'PM',Player.Name,cleansedData,nil,ID)
  921. end
  922. end
  923. end
  924. end
  925.  
  926. function Funcs.Shutdown(Args)
  927. local Player = Args[1]
  928. if not sysTable.shuttingDown then
  929. sysTable.shuttingDown = {}
  930. sysTable.shuttingDown.Name = tostring(Player)
  931. sysTable.shuttingDown.UserId = tostring(Player.UserId)
  932.  
  933. pluginEvent:Fire("Shutdown Logs",{Player,"Shutdown the server with "..tostring(#playerService:GetPlayers())..' player(s).'})
  934. essentialsEvent:FireClient(Player,'Hint','Server','Shutting down..')
  935. essentialsEvent:FireAllClients('Message',sysTable.serverMessage,sysTable.shutdownReason)
  936.  
  937. wait(1)
  938.  
  939. for a,b in next,playerService:GetPlayers() do
  940. b:Kick('Basic Admin\n'..sysTable.shutdownReason)
  941. end
  942. end
  943. end
  944.  
  945. function Funcs.lockSever(Args)
  946. local Player = Args[1]
  947. local Cmd = Args[2]
  948. if Cmd == "slock" then
  949. if not sysTable.serverLocked then
  950. sysTable.serverLocked = true
  951. essentialsEvent:FireClient(Player,'Hint','Success','The server has been locked.')
  952. else
  953. essentialsEvent:FireClient(Player,'Hint','Error','The server was already locked.')
  954. end
  955. elseif Cmd == "unslock" then
  956. if sysTable.serverLocked then
  957. sysTable.serverLocked = false
  958. essentialsEvent:FireClient(Player,'Hint','Success','The server has been unlocked.')
  959. else
  960. essentialsEvent:FireClient(Player,'Hint','Error','The server was already unlocked.')
  961. end
  962. end
  963. end
  964.  
  965. function Funcs.Teleport(Args)
  966. local Player = Args[1]
  967. local playerRoot = Player.Character:FindFirstChild('HumanoidRootPart')
  968. if Args[2] == 'tp' then
  969. if not Args[4] then return end
  970. local Target = returnPlayers(Player,Args[4],Args[2])[1] if not Target then return end
  971. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  972. for a,b in pairs(Players) do
  973. if b.Character:FindFirstChild('HumanoidRootPart') and Target.Character:FindFirstChild('HumanoidRootPart') then
  974. b.Character.HumanoidRootPart.CFrame = (Target.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#Players*a),0)*CFrame.new(5+.2*#Players,0,0))*CFrame.Angles(0,math.rad(90),0)
  975. end
  976. end
  977. elseif Args[2] == 'to' then
  978. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  979. for a,b in pairs(Players) do
  980. if b.Character:FindFirstChild('HumanoidRootPart') then
  981. playerRoot.CFrame = (b.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#Players*a),0)*CFrame.new(5+.2*#Players,0,0))*CFrame.Angles(0,math.rad(90),0)
  982. end
  983. end
  984. elseif Args[2] == 'bring' then
  985. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  986. for a,b in pairs(Players) do
  987. if b.Character:FindFirstChild('HumanoidRootPart') then
  988. b.Character.HumanoidRootPart.CFrame = (playerRoot.CFrame*CFrame.Angles(0,math.rad(90/#Players*a),0)*CFrame.new(5+.2*#Players,0,0))*CFrame.Angles(0,math.rad(90),0)
  989. end
  990. end
  991. end
  992. end
  993.  
  994. function Funcs.Team(Args)
  995. local Player = Args[1]
  996. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  997. if not Args[4] then return end
  998. for a,b in next,Players do
  999. for c,d in next,Teams:GetChildren() do
  1000. if d.Name:lower():find(Args[4]:lower()) == 1 then
  1001. b.TeamColor = d.TeamColor
  1002. end
  1003. end
  1004. end
  1005. end
  1006.  
  1007. function Funcs.Info(Args)
  1008. local Player = Args[1]
  1009. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1010. local memberShip
  1011. for a,b in pairs(Players) do
  1012. if b.MembershipType == Enum.MembershipType.None then
  1013. memberShip = 'NBC'
  1014. elseif b.MembershipType == Enum.MembershipType.BuildersClub then
  1015. memberShip = 'BC'
  1016. elseif b.MembershipType == Enum.MembershipType.TurboBuildersClub then
  1017. memberShip = 'TBC'
  1018. elseif b.MembershipType == Enum.MembershipType.OutrageousBuildersClub then
  1019. memberShip = 'OBC'
  1020. end
  1021. essentialsEvent:FireClient(Player,'Message','Info for '..b.Name,'Account Age: '..b.AccountAge..'\nBuilders Club: '..memberShip)
  1022. end
  1023. end
  1024.  
  1025. local function checkAsset(Id,Type)
  1026. if tonumber(Id) then
  1027. local Asset
  1028. local success,message = pcall(function()
  1029. Asset = Market:GetProductInfo(tonumber(Id))
  1030. end)
  1031. if success then
  1032. if Asset.AssetTypeId == Type then
  1033. return true
  1034. end
  1035. end
  1036. end
  1037. return false
  1038. end
  1039.  
  1040. function Funcs.Gear(Args)
  1041. local Player = Args[1]
  1042. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1043. if not Args[4] then return end
  1044. for a,b in pairs(Players) do
  1045. if checkAsset(Args[4],19) then
  1046. local insertedItem = insertService:LoadAsset(Args[4]):GetChildren()[1] if not insertedItem then return end
  1047. insertedItem.Parent = b.Backpack
  1048. end
  1049. end
  1050. end
  1051.  
  1052. local bansLoaded,trelloDown = false,false
  1053.  
  1054. function Funcs.debugStats(Args)
  1055. local Player = Args[1]
  1056. local tempTable = {
  1057. "HttpEnabled: "..tostring(httpCheck()),
  1058. "Trello Down: "..tostring(trelloDown),
  1059. "Trello Enabled: "..tostring(sysTable.trelloEnabled),
  1060. "Trello Board: "..tostring(sysTable.trelloBoard),
  1061. "Server Sales: "..tostring(sysTable.serverSales),
  1062. "Ban Len: "..string.len(tostring(httpService:JSONEncode(DataCategory.get("Bans") or {}))),
  1063. "Donor Len: "..string.len(tostring(httpService:JSONEncode(DataCategory.get("Cape Data") or {}))),
  1064. "DataStore: "..tostring(sysTable.dataCategory),
  1065. }
  1066. essentialsEvent:FireClient(Player,'List','Debug Stats',false,true,tempTable)
  1067. end
  1068.  
  1069. function Funcs.Hat(Args)
  1070. local Player = Args[1]
  1071. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1072. if not Args[4] then return end
  1073. for a,b in pairs(Players) do
  1074. if checkAsset(Args[4],8) or checkAsset(Args[4],41) or checkAsset(Args[4],42) or checkAsset(Args[4],43) or checkAsset(Args[4],44) or checkAsset(Args[4],45) or checkAsset(Args[4], 46) then
  1075. local insertedItem = insertService:LoadAsset(Args[4]):GetChildren()[1] if not insertedItem then return end
  1076. if insertedItem:IsA('Accoutrement') then
  1077. for c,d in pairs(recursive(insertedItem)) do
  1078. if d:IsA('Script') then
  1079. d:Destroy()
  1080. end
  1081. end
  1082. insertedItem.Parent = b.Character
  1083. else
  1084. insertedItem:Destroy()
  1085. end
  1086. end
  1087. end
  1088. end
  1089.  
  1090. function Funcs.Donor(Args)
  1091. local Player = Args[1]
  1092. if sysTable.donorPerks then
  1093. if sysTable.donorCache[tostring(Player.UserId)] then
  1094. essentialsEvent:FireClient(Player,'Donor')
  1095. else
  1096. Market:PromptPurchase(Player, sysTable.donorID)
  1097. end
  1098. end
  1099. end
  1100.  
  1101. local function banId(playerId,playerName,Reason)
  1102. -- if checkDebugger(playerId) then return end
  1103.  
  1104. for _,Player in next,playerService:GetPlayers() do
  1105. if tostring(Player.UserId) == tostring(playerId) then
  1106. Player:Kick('Basic Admin\n'..sysTable.exploitMessage)
  1107. end
  1108. end
  1109.  
  1110. local Succ,Msg = pcall(function()
  1111. local pBans = DataCategory.update('Bans',function(Previous)
  1112. local toReturn
  1113. if Previous then
  1114. toReturn = unpack({Previous})
  1115. else
  1116. toReturn = {}
  1117. end
  1118. if toReturn ~= {} then
  1119. for a,b in next,toReturn do
  1120. if tonumber(b[1]) == tonumber(playerId) then
  1121. table.remove(toReturn,a)
  1122. return
  1123. end
  1124. end
  1125. end
  1126. table.insert(toReturn,{playerId,playerName,Reason})
  1127. return toReturn
  1128. end)
  1129. end)
  1130.  
  1131. pluginEvent:Fire("Exploit Logs",{playerId})
  1132. addLog(sysTable.debugLogs,'[Exploiter] '..playerId..', '..playerName)
  1133. end
  1134.  
  1135. local function checkTable(Table,Data)
  1136. for a,b in next,Table do
  1137. if tostring(b[1]) == tostring(Data) then
  1138. return true
  1139. end
  1140. end
  1141. return
  1142. end
  1143.  
  1144. function Funcs.permBan(Args)
  1145. local Player = Args[1]
  1146. local Cmd = Args[2]
  1147. local Players = returnPlayers(Player,Args[3],Args[2])
  1148. if Cmd == "pban" or Cmd == "pbanid" then
  1149. local Succ,Msg = pcall(function()
  1150. local victimTable = {}
  1151. local victimName,victimId
  1152. local givenReason
  1153. if Args[4] then
  1154. local combinedArgs = ""
  1155. for a,b in pairs(Args) do
  1156. if a > 3 then
  1157. combinedArgs = combinedArgs..b..' '
  1158. end
  1159. end
  1160. if combinedArgs ~= "" then
  1161. givenReason = combinedArgs
  1162. end
  1163. end
  1164.  
  1165. if not Players then
  1166. local Succ,Msg = pcall(function()
  1167. if Cmd == "pban" then
  1168. victimId = tonumber(playerService:GetUserIdFromNameAsync(Args[3]))
  1169. victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
  1170. else
  1171. victimId = tonumber(Args[3])
  1172. victimName = tostring(playerService:GetNameFromUserIdAsync(Args[3]))
  1173. end
  1174. end)
  1175. if Succ and not Msg then
  1176. if not DataCategory.get(tostring(victimId)..'_Banned') then
  1177. if returnPerms_ID(victimId) >= returnPermission(Player) then
  1178. return
  1179. else
  1180. table.insert(victimTable,{victimId,victimName})
  1181. local dateTable = {timeAndDate.Date()}
  1182. local dateString = dateTable[2]..'/'..dateTable[3]..'/'..string.sub(dateTable[1],3)
  1183. local reasonString = ''
  1184.  
  1185. if givenReason then
  1186. local Cleaned,newData = cleanUserData(givenReason,Player,false)
  1187. if Cleaned and newData then
  1188. givenReason = newData
  1189. elseif not Cleaned then
  1190. if newData and newData:lower():match('cannot communicate with') then
  1191. givenReason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
  1192. else
  1193. if not newData then
  1194. essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from communicating in any way, so a reason will not be provided.')
  1195. givenReason = nil
  1196. else
  1197. givenReason = newData
  1198. end
  1199. end
  1200. end
  1201.  
  1202. if givenReason ~= nil then
  1203. reasonString = ', Reason: '..givenReason
  1204. end
  1205. end
  1206.  
  1207. local Succ,Msg = pcall(function()
  1208. DataCategory.set(tostring(victimId)..'_Banned',{Victim = victimName,Banner = Player.Name,Date = dateString, Reason = givenReason})
  1209. end)
  1210.  
  1211. if not Succ and Msg then
  1212. essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to ban that user.')
  1213. end
  1214.  
  1215. for a,b in next,playerService:GetPlayers() do
  1216. if tostring(b.UserId) == tostring(victimId) then
  1217. b:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..reasonString)
  1218. end
  1219. end
  1220. end
  1221. end
  1222. else
  1223. essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to "'..Cmd..'"'..'\n'..Msg)
  1224. return
  1225. end
  1226. else
  1227. for a,b in next,Players do
  1228. if returnPerms_ID(b.UserId) < returnPermission(Player) then
  1229. table.insert(victimTable,{b.UserId,b.Name})
  1230. local dateTable = {timeAndDate.Date()}
  1231. local dateString = dateTable[2]..'/'..dateTable[3]..'/'..string.sub(dateTable[1],3)
  1232. local reasonString = ''
  1233.  
  1234. if givenReason then
  1235. local Cleaned,newData = cleanUserData(givenReason,Player,false)
  1236. if Cleaned and newData then
  1237. givenReason = newData
  1238. elseif not Cleaned then
  1239. if newData and newData:lower():match('cannot communicate with') then
  1240. givenReason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
  1241. else
  1242. if not newData then
  1243. essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from communicating in any way, so a reason will not be provided.')
  1244. givenReason = nil
  1245. else
  1246. givenReason = newData
  1247. end
  1248. end
  1249. end
  1250.  
  1251. if givenReason ~= nil then
  1252. reasonString = ', Reason: '..givenReason
  1253. end
  1254. end
  1255.  
  1256. local Succ,Msg = pcall(function()
  1257. DataCategory.set(tostring(b.UserId)..'_Banned',{Victim = b.Name,Banner = Player.Name,Date = dateString,Reason = givenReason})
  1258. end)
  1259.  
  1260. if not Succ and Msg then
  1261. essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to ban that user.')
  1262. end
  1263.  
  1264. b:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..reasonString)
  1265. end
  1266. end
  1267. end
  1268.  
  1269. if #victimTable > 0 then
  1270. local toSend
  1271. for a,b in next,victimTable do
  1272. if not toSend then
  1273. toSend = b[1]..', '..b[2]
  1274. else
  1275. toSend = toSend..' | '..b[1]..', '..b[2]
  1276. end
  1277. end
  1278. essentialsEvent:FireClient(Player,'Hint',"Permanently Banned",toSend)
  1279. else
  1280. essentialsEvent:FireClient(Player,'Hint',"Error","User already banned, or an unexpected error occurred.")
  1281. end
  1282. end)
  1283. if Msg then
  1284. addLog(sysTable.debugLogs,'Funcs.permBan, "pban", Message: '..Msg or "Err")
  1285. end
  1286. elseif Cmd == "unpban" or Cmd == "unpbanid" then
  1287. local Succ,Msg = pcall(function()
  1288. local victimId,victimName,Removed
  1289. local Succ,Msg = pcall(function()
  1290. if Cmd == "unpban" then
  1291. victimId = tonumber(playerService:GetUserIdFromNameAsync(Args[3]))
  1292. victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
  1293. else
  1294. victimId = tonumber(Args[3])
  1295. victimName = tostring(playerService:GetNameFromUserIdAsync(Args[3]))
  1296. end
  1297. end)
  1298. if Succ and not Msg then
  1299. local bannedStatus
  1300. local Succ,Msg = pcall(function()
  1301. bannedStatus = DataCategory.get(tostring(victimId)..'_Banned')
  1302. end)
  1303. if Succ and bannedStatus then
  1304. local Succ,Msg = pcall(function()
  1305. DataCategory.remove(tostring(victimId)..'_Banned')
  1306. end)
  1307. if Succ then
  1308. Removed = true
  1309. elseif Msg then
  1310. addLog(sysTable.debugLogs,'Funcs.permBan remove, "unpban", Message: '..Msg or "Err")
  1311. end
  1312. elseif Succ and not bannedStatus then
  1313. local Succ,Msg = pcall(function()
  1314. local pBans = DataCategory.update('Bans',function(Previous)
  1315. local toReturn
  1316. if Previous then
  1317. toReturn = Previous
  1318. for a,b in next,toReturn do
  1319. if tonumber(b[1]) == tonumber(victimId) then
  1320. Removed = true
  1321. table.remove(toReturn,a)
  1322. break
  1323. end
  1324. end
  1325. end
  1326. return toReturn
  1327. end)
  1328. end)
  1329. if Msg then
  1330. addLog(sysTable.debugLogs,'Funcs.permBan update, "unpban", Message: '..Msg or "Err")
  1331. end
  1332. end
  1333. else
  1334. essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to "'..Cmd..'"'..'\n'..Msg)
  1335. return
  1336. end
  1337. if Removed then
  1338. essentialsEvent:FireClient(Player,'Hint',"Un-Permanently Banned",victimId..', '..victimName)
  1339. else
  1340. essentialsEvent:FireClient(Player,'Hint',"Error","User was not already banned, or an unexpected error occurred.")
  1341. end
  1342. end)
  1343. if Msg then
  1344. addLog(sysTable.debugLogs,'Funcs.permBan, "unpban", Message: '..Msg or "Err")
  1345. end
  1346. elseif Cmd == "pbans" then
  1347. essentialsEvent:FireClient(Player,'PBans',returnPSAMessage(Player,'legacy_pban_dep'))
  1348. end
  1349. end
  1350.  
  1351. function Funcs.changeStats(Args)
  1352. local Player = Args[1]
  1353. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1354. if Args[4] and Args[5] then
  1355. local combinedArgs = ''
  1356. for i,v in pairs(Args) do
  1357. if i > 4 then
  1358. combinedArgs = combinedArgs..v..' '
  1359. end
  1360. end
  1361.  
  1362. if string.sub(combinedArgs,#combinedArgs,#combinedArgs) == ' ' then
  1363. combinedArgs = string.sub(combinedArgs,1,#combinedArgs-1)
  1364. end
  1365.  
  1366. local cleansedVal = ''
  1367. if not tonumber(combinedArgs) then -- for number values
  1368. local Cleaned,newData = cleanUserData(combinedArgs,Player,false)
  1369.  
  1370. if Cleaned and newData then
  1371. cleansedVal = newData
  1372. elseif not Cleaned then
  1373. cleansedVal = newData
  1374. end
  1375. else
  1376. cleansedVal = tonumber(combinedArgs)
  1377. end
  1378.  
  1379. for a,b in pairs(Players) do
  1380. if b:FindFirstChild('leaderstats') then
  1381. local leaderStats = b:FindFirstChild('leaderstats')
  1382. for c,d in pairs(leaderStats:children()) do
  1383. if d.Name:lower():find(Args[4]:lower()) == 1 then
  1384. d.Value = cleansedVal
  1385. end
  1386. end
  1387. end
  1388. end
  1389. end
  1390. end
  1391.  
  1392. function Funcs.healPlayer(Args)
  1393. local Player = Args[1]
  1394. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1395. for a,b in next,Players do
  1396. if b.Character and b.Character:FindFirstChild('Humanoid') then
  1397. local Hum = b.Character:WaitForChild('Humanoid')
  1398. Hum.Health = Hum.MaxHealth
  1399. end
  1400. end
  1401. end
  1402.  
  1403. function Funcs.setJump(Args)
  1404. local Player = Args[1]
  1405. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1406. if Args[4] and tonumber(Args[4]) then
  1407. for a,b in next,Players do
  1408. if b.Character and b.Character:FindFirstChild('Humanoid') then
  1409. local Hum = b.Character:WaitForChild('Humanoid')
  1410. Hum.JumpPower = Args[4]
  1411. end
  1412. end
  1413. end
  1414. end
  1415.  
  1416. function Funcs.insertModel(Args)
  1417. local Player = Args[1]
  1418. if Args[3] and tonumber(Args[3]) and Player.Character then
  1419. local rootPart = Player.Character:WaitForChild('HumanoidRootPart')
  1420. local assetId = Args[3]
  1421. local Model = insertService:LoadAsset(assetId)
  1422. Model.Parent = Workspace
  1423. Model.Name = 'BAE Inserted'
  1424. Model:MakeJoints()
  1425. Model:MoveTo(rootPart.Position)
  1426. end
  1427. end
  1428.  
  1429. function Funcs.crashPlayer(Args)
  1430. local Player = Args[1]
  1431. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1432. for a,b in next,Players do
  1433. essentialsEvent:FireClient(b,'Crash')
  1434. end
  1435. end
  1436.  
  1437. function Funcs.Fly(Args)
  1438. local Player = Args[1]
  1439. local Command = Args[2]
  1440. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1441. if Command == "fly" then
  1442. for a,b in next,Players do
  1443. essentialsEvent:FireClient(b,'Fly',true)
  1444. end
  1445. elseif Command == "unfly" then
  1446. for a,b in next,Players do
  1447. essentialsEvent:FireClient(b,'Fly',false)
  1448. end
  1449. end
  1450. end
  1451.  
  1452. function Funcs.Utility(Args)
  1453. local Player = Args[1]
  1454. local Players = returnPlayers(Player,Args[3],Args[2])
  1455. if not Players then return end
  1456. if Args[2] == 'btools' then
  1457. for a,b in pairs(Players) do
  1458. local F3XClone = F3X:Clone()
  1459. F3XClone.Parent = b.Backpack
  1460. end
  1461. elseif Args[2] == 'segway' then
  1462. for a,b in pairs(Players) do
  1463. local segwayClone = Segway:Clone()
  1464. segwayClone.Parent = b.Backpack
  1465. end
  1466. end
  1467. end
  1468.  
  1469. function Funcs.getAdmin(Args)
  1470. local Player = Args[1]
  1471. Market:PromptPurchase(Player, sysTable.adminId)
  1472. end
  1473.  
  1474. function Funcs.Give(Args)
  1475. local Player = Args[1]
  1476. local Players = returnPlayers(Player,Args[3],Args[2])
  1477. for a,b in pairs(Players) do
  1478. for c,d in pairs(recursive(sysTable.toolLocation)) do
  1479. if (d:IsA('Tool') or d:IsA('HopperBin')) and not playerService:GetPlayerFromCharacter(d.Parent) then
  1480. if Args[4]:lower() ~= 'all' then
  1481. if d.Name:lower():find(Args[4]:lower()) == 1 then
  1482. d:Clone().Parent = b.Backpack
  1483. if Args[2] == 'startergear' then
  1484. d:Clone().Parent = b.StarterGear
  1485. end
  1486. end
  1487. else
  1488. d:Clone().Parent = b.Backpack
  1489. if Args[2] == 'startergear' then
  1490. d:Clone().Parent = b.StarterGear
  1491. end
  1492. end
  1493. end
  1494. end
  1495. end
  1496. end
  1497.  
  1498. local function awardCape(Player,cColor,cMat,cDecal)
  1499. local b = Player
  1500. if not cColor then
  1501. cColor = BrickColor.new('Really black')
  1502. else
  1503. cColor = BrickColor.new(tostring(cColor))
  1504. end
  1505. local cMat = cMat or Enum.Material.SmoothPlastic
  1506. local cDecal = cDecal
  1507. if b.Character and b.Character:FindFirstChild('Humanoid') and not b.Character:FindFirstChild('BAE Cape') then
  1508. local Hum = b.Character.Humanoid
  1509. local basePart
  1510. local Ded
  1511. if Hum.RigType == Enum.HumanoidRigType.R15 then
  1512. basePart = b.Character:WaitForChild('UpperTorso')
  1513. Ded = 2
  1514. else
  1515. basePart = b.Character:WaitForChild('Torso')
  1516. Ded = 1.8
  1517. end
  1518.  
  1519. local capePart = Instance.new("Part", b.Character)
  1520. capePart.Name = "BAE Cape"
  1521. capePart.Anchored = false
  1522. capePart.CanCollide = false
  1523. capePart.TopSurface = 0
  1524. capePart.BottomSurface = 0
  1525. capePart.BrickColor = cColor
  1526. capePart.Material = cMat
  1527. capePart.FormFactor = Enum.FormFactor.Custom
  1528. capePart.Size = Vector3.new(.2,.2,.2)
  1529.  
  1530. local capeMesh = Instance.new('BlockMesh',capePart)
  1531. capeMesh.Scale = Vector3.new(9,17.5,.25)
  1532.  
  1533. local capeDecal = Instance.new("Decal", capePart)
  1534. capeDecal.Face = 2
  1535.  
  1536. if cDecal then
  1537. capeDecal.Texture = "rbxassetid://"..cDecal
  1538. else
  1539. capeDecal.Texture = "rbxassetid://"..419363338
  1540. end
  1541.  
  1542. local capeMotor = Instance.new("Motor", capePart)
  1543. capeMotor.Name = "Motor"
  1544. capeMotor.Part0 = capePart
  1545. capeMotor.Part1 = basePart
  1546. capeMotor.MaxVelocity = 0.05
  1547. capeMotor.C0 = CFrame.new(0,Ded,0) * CFrame.Angles(0,math.rad(90),0)
  1548. capeMotor.C1 = CFrame.new(0,basePart.Size.Z,basePart.Size.Z/2-0.015) * CFrame.Angles(0,math.rad(90),0)
  1549. elseif b.Character and b.Character:FindFirstChild('Humanoid') and b.Character:FindFirstChild('BAE Cape') then
  1550. b.Character['BAE Cape']:Destroy()
  1551. awardCape(Player,cColor,cMat,cDecal)
  1552. end
  1553. end
  1554.  
  1555. local function saveCapeData(Player,Data)
  1556. local Succ,Msg = pcall(function()
  1557. if not Data then
  1558. DataCategory.remove(Player.UserId..'_Cape')
  1559. else
  1560. DataCategory.update(Player.UserId..'_Cape',function(Previous)
  1561. Previous = Data
  1562. return Previous
  1563. end)
  1564. end
  1565. end)
  1566.  
  1567. local capeData = DataCategory.get(Player.UserId..'_Cape')
  1568. if not capeData and not Data then
  1569. local Succ,Msg = pcall(function()
  1570. DataCategory.update('Cape Data',function(Previous)
  1571. local toReturn
  1572. if Previous then
  1573. toReturn = unpack({Previous})
  1574. else
  1575. toReturn = {}
  1576. end
  1577. if toReturn ~= {} then
  1578. for a,b in next,toReturn do
  1579. if tostring(b[1]) == tostring(Player.UserId) then
  1580. table.remove(toReturn,a)
  1581. end
  1582. end
  1583. end
  1584. return toReturn
  1585. end)
  1586. end)
  1587. return Succ,Msg
  1588. else
  1589. return Succ,Msg
  1590. end
  1591. end
  1592.  
  1593. local function getCapeData(Player)
  1594. local capeData
  1595. local Succ,Msg = pcall(function()
  1596. capeData = DataCategory.get(Player.UserId..'_Cape')
  1597. end)
  1598.  
  1599. if Succ and capeData then
  1600. return capeData
  1601. elseif Succ and not capeData then
  1602. local oldCape
  1603. local Succ,Msg = pcall(function()
  1604. oldCape = DataCategory.get("Cape Data")
  1605. end)
  1606. if Succ and oldCape then
  1607. local Succ,Msg = pcall(function()
  1608. for a,b in next,oldCape do
  1609. if b and b[1] ~= nil and b[3] ~= nil then
  1610. if tostring(Player.UserId) == tostring(b[1]) then
  1611. capeData = b[3]
  1612. break
  1613. end
  1614. end
  1615. end
  1616. end)
  1617. if Succ and capeData then
  1618. return capeData
  1619. end
  1620. end
  1621. end
  1622. end
  1623.  
  1624. function Funcs.Cape(Args)
  1625. local Player = Args[1]
  1626. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1627. if Args[2] == "awardcape" then
  1628. for a,b in pairs(Players) do
  1629. awardCape(b)
  1630. end
  1631. elseif Args[2] == 'uncape' then
  1632. for a,b in next,Players do
  1633. if b.Character and b.Character:FindFirstChild('BAE Cape') then
  1634. b.Character['BAE Cape']:Destroy()
  1635. end
  1636. end
  1637. end
  1638. end
  1639.  
  1640. local function LoadScript(Source)
  1641. local Func,Err = loadStringModule(Source,getfenv())
  1642. if Func then
  1643. Func()
  1644. return true
  1645. else
  1646. return Err
  1647. end
  1648. end
  1649.  
  1650. function Funcs.doScript(Args)
  1651. local Player = Args[1]
  1652. if Args[3] ~= nil then
  1653. local combinedArgs = ''
  1654. for i,v in pairs(Args) do
  1655. if i > 2 then
  1656. combinedArgs = combinedArgs..v..' '
  1657. end
  1658. end
  1659. local Response = LoadScript(combinedArgs)
  1660. if Response == true then
  1661. essentialsEvent:FireClient(Player,'Hint','Success','Executed code.')
  1662. else
  1663. essentialsEvent:FireClient(Player,'Message','Script Error',Response)
  1664. end
  1665. end
  1666. end
  1667.  
  1668. local function format_int(number)
  1669. local i, j, minus, int, fraction = tostring(number):find('([-]?)(%d+)([.]?%d*)')
  1670. int = int:reverse():gsub("(%d%d%d)", "%1,")
  1671. return minus .. int:reverse():gsub("^,", "") .. fraction
  1672. end
  1673.  
  1674. function Funcs.itemStats(Args)
  1675. local Player = Args[1]
  1676. if not Args[3] then return end
  1677. for Segment in Args[3]:gmatch('([^,]+)') do
  1678. local lowerSegment = Segment:lower()
  1679. local Table = {}
  1680. local prodInfo
  1681. local prodName
  1682. local Amt,priceInRS = 0,0
  1683. local Succ, Fail = pcall(function()
  1684. prodInfo = Market:GetProductInfo(lowerSegment)
  1685. end)
  1686. if Succ then
  1687. prodName = prodInfo.Name
  1688. priceInRS = (prodInfo.PriceInRobux) or 0
  1689. if priceInRS ~= 0 then
  1690. Amt = (priceInRS-(priceInRS*0.30))*prodInfo.Sales
  1691. end
  1692. table.insert(Table,'Name: '..prodInfo.Name)
  1693. table.insert(Table,'Created: '..string.sub(prodInfo.Created,1,10))
  1694. table.insert(Table,'Updated: '..string.sub(prodInfo.Updated,1,10))
  1695. table.insert(Table,'Creator: '..prodInfo.Creator.Name)
  1696. table.insert(Table,'IsForSale: '..tostring(prodInfo.IsForSale))
  1697. table.insert(Table,'Price: R$'..format_int(priceInRS))
  1698. table.insert(Table,'Sales: '..format_int(prodInfo.Sales))
  1699. table.insert(Table,'Est. R$: '..format_int(Amt))
  1700. if Amt >= 100000 then -- 0.0025
  1701. table.insert(Table,'Est. DevEx: $'..format_int(0.0025*Amt)..'*')
  1702. table.insert(Table,'*DevEx rates apply, this is an est.')
  1703. else
  1704. table.insert(Table,'Est. DevEx: Not enough R$')
  1705. end
  1706. end
  1707. essentialsEvent:FireClient(Player,'List','Statistics',false,true,Table)
  1708. end
  1709. end
  1710.  
  1711. function Funcs.Jump(Args)
  1712. local Player = Args[1]
  1713. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1714. for a,b in next,Players do
  1715. if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
  1716. local playerHum = b.Character:WaitForChild('Humanoid')
  1717. playerHum.Jump = true
  1718. end
  1719. end
  1720. end
  1721.  
  1722. function Funcs.Sit(Args)
  1723. local Player = Args[1]
  1724. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1725. for a,b in next,Players do
  1726. if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
  1727. local playerHum = b.Character:WaitForChild('Humanoid')
  1728. playerHum.Sit = true
  1729. end
  1730. end
  1731. end
  1732.  
  1733. function Funcs.View(Args)
  1734. local Player = Args[1]
  1735. if Args[2] == 'view' then
  1736. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1737. for a,b in next,Players do
  1738. if b.Character:FindFirstChild('Humanoid') then
  1739. essentialsEvent:FireClient(Player,'View',b.Character.Humanoid)
  1740. end
  1741. end
  1742. elseif Args[2] == 'unview' then
  1743. essentialsEvent:FireClient(Player,'View',nil)
  1744. end
  1745. end
  1746.  
  1747. function Funcs.Buy(Args)
  1748. local Player = Args[1]
  1749. if not Args[3] or not Args[4] then return end
  1750. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1751. for a,b in next,Players do
  1752. Market:PromptPurchase(b, tonumber(Args[4]))
  1753. end
  1754. end
  1755.  
  1756. function Funcs.Clean(Args)
  1757. local Player = Args[1]
  1758. for a,Obj in next, workspace:GetChildren() do
  1759. if Obj:IsA('Accoutrement') then
  1760. if playerService:GetPlayerFromCharacter(Obj.Parent) then
  1761. return
  1762. else
  1763. Debris:AddItem(Obj,0.1)
  1764. end
  1765. end
  1766. end
  1767. end
  1768.  
  1769. function Funcs.Speed(Args)
  1770. local Player = Args[1]
  1771. if not Args[4] and not (tostring(Args[4]) and tonumber(Args[4])) then return end
  1772. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1773. for a,b in next,Players do
  1774. if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
  1775. local playerHum = b.Character:WaitForChild('Humanoid')
  1776. playerHum.WalkSpeed = Args[4]
  1777. end
  1778. end
  1779. end
  1780.  
  1781. function Funcs.Refresh(Args)
  1782. local Player = Args[1]
  1783. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1784. for a,b in next,Players do
  1785. if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('HumanoidRootPart') then
  1786. spawn(function()
  1787. local rootPart = b.Character:WaitForChild('HumanoidRootPart')
  1788. local prevPos = rootPart.CFrame
  1789. b:LoadCharacter()
  1790. repeat
  1791. if b == nil or b.Parent == nil then
  1792. return
  1793. end
  1794. wait()
  1795. until b.Character ~= nil
  1796. rootPart = b.Character:WaitForChild('HumanoidRootPart')
  1797. rootPart.CFrame = prevPos
  1798. end)
  1799. runService.Heartbeat:wait()
  1800. end
  1801. end
  1802. end
  1803.  
  1804. function Funcs.Rejoin(Args)
  1805. local Player = Args[1]
  1806. teleportService:Teleport(game.PlaceId, Player)
  1807. end
  1808.  
  1809. local function checkAsset(Id,Type)
  1810. if tonumber(Id) then
  1811. local Asset
  1812. local success,message = pcall(function()
  1813. Asset = Market:GetProductInfo(tonumber(Id))
  1814. end)
  1815. if success then
  1816. if Asset.AssetTypeId == Type then
  1817. return true
  1818. end
  1819. end
  1820. end
  1821. return false
  1822. end
  1823.  
  1824. function Funcs.Place(Args)
  1825. local Player = Args[1]
  1826. if not Args[4] then return end
  1827. if checkAsset(Args[4],9) then
  1828. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1829. for a,b in next,Players do
  1830. teleportService:Teleport(Args[4], b)
  1831. end
  1832. end
  1833. end
  1834.  
  1835. function Funcs.God(Args)
  1836. local Player = Args[1]
  1837. if Args[2] == "god" or Args[2] == "ungod" then
  1838. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1839. for a,b in next,Players do
  1840. if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
  1841. local playerHum = b.Character:WaitForChild('Humanoid')
  1842. if Args[2] == "god" then
  1843. playerHum.MaxHealth = math.huge
  1844. playerHum.Health = math.huge
  1845. elseif Args[2] == "ungod" then
  1846. playerHum.MaxHealth = 100
  1847. playerHum.Health = 100
  1848. end
  1849. end
  1850. end
  1851. end
  1852. end
  1853.  
  1854. function Funcs.FF(Args)
  1855. local Player = Args[1]
  1856. if Args[2] == "ff" or Args[2] == "unff" then
  1857. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1858. for a,b in next,Players do
  1859. if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
  1860. local playerHum = b.Character:WaitForChild('Humanoid')
  1861. if Args[2] == "ff" then
  1862. local FF = Instance.new('ForceField',b.Character)
  1863. elseif Args[2] == "unff" then
  1864. for a,b in next,b.Character:GetChildren() do
  1865. if b:IsA('ForceField') then
  1866. b:Destroy()
  1867. end
  1868. end
  1869. end
  1870. end
  1871. end
  1872. end
  1873. end
  1874.  
  1875. function Funcs.Time(Args)
  1876. local Player = Args[1]
  1877. if Args[3] then
  1878. local combinedArgs
  1879. for i,v in pairs(Args) do
  1880. if i > 2 then
  1881. if not combinedArgs then
  1882. combinedArgs = v
  1883. else
  1884. combinedArgs = combinedArgs..v
  1885. end
  1886. end
  1887. end
  1888. Lighting.TimeOfDay = combinedArgs
  1889. end
  1890. end
  1891.  
  1892. function Funcs.removeTools(Args)
  1893. local Player = Args[1]
  1894. local Command = Args[2]
  1895. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  1896. if Command == "removetools" then
  1897. for a,b in next,Players do
  1898. for a,b in next,b.Backpack:GetChildren() do
  1899. if b:IsA('Tool') or b:IsA('HopperBin') then
  1900. b:Destroy()
  1901. end
  1902. end
  1903. end
  1904. elseif Command == "clearstartergear" then
  1905. for a,b in next,Players do
  1906. for c,d in pairs(b.Backpack:GetChildren()) do
  1907. if d:IsA('Tool') or d:IsA('HopperBin') then
  1908. d:Destroy()
  1909. end
  1910. end
  1911. for e,f in pairs(b.StarterGear:GetChildren()) do
  1912. if f:IsA('Tool') or f:IsA('HopperBin') then
  1913. f:Destroy()
  1914. end
  1915. end
  1916. end
  1917. end
  1918. end
  1919.  
  1920. function Funcs.Clear(Args)
  1921. local Player = Args[1]
  1922. local Command = Args[2]
  1923. sysTable.countingDown = false
  1924. essentialsEvent:FireAllClients('Clear')
  1925. end
  1926.  
  1927. function Funcs.manipulateServer(Args)
  1928. local Player = Args[1]
  1929. if Args[2] == 'createserver' then
  1930. if Args[3] then
  1931. local Place = game.PlaceId
  1932. local Code = teleportService:ReserveServer(Place)
  1933. local combinedArgs = ''
  1934. for i,v in pairs(Args) do
  1935. if i > 2 then
  1936. combinedArgs = combinedArgs..v..' '
  1937. end
  1938. end
  1939.  
  1940. local cleanedData
  1941. local Cleaned,newData = cleanUserData(combinedArgs,Player,false)
  1942.  
  1943. if Cleaned and newData then
  1944. cleanedData = newData
  1945. elseif not Cleaned then
  1946. if not newData then
  1947. essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from communicating in any way.')
  1948. return
  1949. else
  1950. cleanedData = newData
  1951. end
  1952. end
  1953.  
  1954. if cleanedData == combinedArgs then
  1955. table.insert(sysTable.privateServers,{Code,Place,combinedArgs})
  1956. else
  1957. essentialsEvent:FireClient(Player,'Hint','Error','Your server name was censored, please try again.')
  1958. end
  1959. end
  1960. elseif Args[2] == 'deleteserver' then
  1961. if #sysTable.privateServers > 0 then
  1962. if Args[3] then
  1963. local combinedArgs = ''
  1964. for i,v in pairs(Args) do
  1965. if i > 2 then
  1966. combinedArgs = combinedArgs..v..' '
  1967. end
  1968. end
  1969. for a,b in next,sysTable.privateServers do
  1970. if combinedArgs == b[3] then
  1971. table.remove(sysTable.privateServers,sysTable.privateServers[b])
  1972. end
  1973. end
  1974. end
  1975. else
  1976. essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
  1977. end
  1978. elseif Args[2] == 'joinserver' then -- service.TeleportService:TeleportToPrivateServer(code.ID,code.Code,{v})
  1979. if #sysTable.privateServers > 0 then
  1980. if Args[3] then
  1981. local combinedArgs = ''
  1982. for i,v in pairs(Args) do
  1983. if i > 2 then
  1984. combinedArgs = combinedArgs..v..' '
  1985. end
  1986. end
  1987. for a,b in next,sysTable.privateServers do
  1988. if combinedArgs == b[3] then
  1989. teleportService:TeleportToPrivateServer(b[2],b[1],{Player})
  1990. end
  1991. end
  1992. end
  1993. else
  1994. essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
  1995. end
  1996. elseif Args[2] == 'privateservers' then
  1997. if #sysTable.privateServers > 0 then
  1998. local tempTab = {}
  1999. for a,b in pairs(sysTable.privateServers) do
  2000. table.insert(tempTab,b[3])
  2001. end
  2002. essentialsEvent:FireClient(Player,'List','Private Servers',false,true,tempTab)
  2003. else
  2004. essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
  2005. end
  2006. elseif Args[2] == 'toreserved' then
  2007. if Args[4] then
  2008. if #sysTable.privateServers > 0 then
  2009. local combinedArgs = ''
  2010. for i,v in pairs(Args) do
  2011. if i > 3 then
  2012. combinedArgs = combinedArgs..v..' '
  2013. end
  2014. end
  2015. for a,b in next,sysTable.privateServers do
  2016. if combinedArgs == b[3] then
  2017. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  2018. for c,d in pairs(Players) do
  2019. teleportService:TeleportToPrivateServer(b[2],b[1],{d})
  2020. end
  2021. end
  2022. end
  2023. else
  2024. essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
  2025. end
  2026. end
  2027. end
  2028. end
  2029.  
  2030. function Funcs.viewTools(Args)
  2031. local Player = Args[1]
  2032. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  2033. for a,b in next,Players do
  2034. local Backpack = b:FindFirstChild('Backpack')
  2035. if Backpack then
  2036. local Tools = {}
  2037. for c,d in next,Backpack:GetChildren() do
  2038. if d:IsA('Tool') or d:IsA('HopperBin') then
  2039. table.insert(Tools,tostring(d))
  2040. end
  2041. end
  2042.  
  2043. if b.Character ~= nil then
  2044. local onCharacter = b.Character:FindFirstChildOfClass('Tool') or b.Character:FindFirstChildOfClass('HopperBin')
  2045. if onCharacter then
  2046. table.insert(Tools,tostring(onCharacter))
  2047. end
  2048. end
  2049.  
  2050. essentialsEvent:FireClient(Player,'List',b.Name..'\'s Backpack',false,true,Tools)
  2051. end
  2052. end
  2053. end
  2054.  
  2055. function Funcs.namePlayer(Args)
  2056. local Player = Args[1]
  2057. local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
  2058. if Args[2] == 'name' then
  2059. local combinedArgs = ''
  2060. for i,v in pairs(Args) do
  2061. if i > 3 then
  2062. combinedArgs = combinedArgs..v..' '
  2063. end
  2064. end
  2065.  
  2066. for a,b in next,Players do
  2067. local filteredName = ''
  2068.  
  2069. sysTable.localNames[b] = {Sender = b,Data = combinedArgs} -- Would store Player, but we can't filter users offline!
  2070. local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
  2071.  
  2072. if Cleaned and newData then
  2073. filteredName = newData
  2074. elseif not Cleaned then
  2075. filteredName = newData
  2076. end
  2077.  
  2078. for c,d in next,playerService:GetPlayers() do
  2079. essentialsEvent:FireClient(d,'Local Name',b,filteredName)
  2080. end
  2081. end
  2082. elseif Args[2] == 'unname' then
  2083. for a,b in next,Players do
  2084. for c,d in next,playerService:GetPlayers() do
  2085. if sysTable.localNames[b] then
  2086. sysTable.localNames[b] = nil
  2087. end
  2088. essentialsEvent:FireClient(d,'Local Name',b)
  2089. end
  2090. end
  2091. end
  2092. end
  2093.  
  2094. function Funcs.playSong(Args)
  2095. local Player = Args[1]
  2096. if Args[2] == 'play' then
  2097. local function playSound(songId)
  2098. if checkAsset(songId,3) then
  2099. local S = Instance.new('Sound',workspace)
  2100. S.Name = 'BAE Sound'
  2101. S.SoundId = 'rbxassetid://'..Args[3]
  2102. S.Volume = 1
  2103. S.Pitch = 1
  2104. if Args[4] ~= nil then
  2105. S.Looped = true
  2106. end
  2107. S:Play()
  2108. if S.TimeLength <= 0 then
  2109. essentialsEvent:FireClient(Player,'Hint','Loading..',Market:GetProductInfo(Args[3]).Name)
  2110. local changedCon
  2111. changedCon = S.Changed:Connect(function(Prop)
  2112. if Prop == "TimeLength" and S.TimeLength > 0 then
  2113. changedCon:Disconnect()
  2114. essentialsEvent:FireClient(Player,'Hint','Now Playing',Market:GetProductInfo(Args[3]).Name)
  2115. elseif Prop == "Parent" and S.Parent == nil then
  2116. changedCon:Disconnect()
  2117. end
  2118. end)
  2119. else
  2120. essentialsEvent:FireClient(Player,'Hint','Now Playing',Market:GetProductInfo(Args[3]).Name)
  2121. end
  2122. end
  2123. end
  2124. local S = workspace:FindFirstChild('BAE Sound')
  2125. if not S then
  2126. playSound(Args[3])
  2127. else
  2128. local changedCon
  2129. changedCon = S.Changed:Connect(function(Prop)
  2130. if Prop == "Parent" and S.Parent == nil then
  2131. changedCon:Disconnect()
  2132. playSound(Args[3])
  2133. end
  2134. end)
  2135.  
  2136. S:Destroy()
  2137. end
  2138. elseif Args[2] == 'stopsound' then
  2139. local S = workspace:FindFirstChild('BAE Sound')
  2140. if S then
  2141. S:Destroy()
  2142. end
  2143. elseif Args[2] == 'volume' then
  2144. if tonumber(Args[3]) then
  2145. local Vol = Args[3]
  2146. if workspace:FindFirstChild('BAE Sound') then
  2147. local S = workspace:FindFirstChild('BAE Sound')
  2148. S.Volume = Vol
  2149. end
  2150. end
  2151. elseif Args[2] == 'pitch' then
  2152. if tonumber(Args[3]) then
  2153. local Pitch = Args[3]
  2154. if workspace:FindFirstChild('BAE Sound') then
  2155. local S = workspace:FindFirstChild('BAE Sound')
  2156. S.Pitch = Pitch
  2157. end
  2158. end
  2159. end
  2160. end
  2161.  
  2162. local function checkTrelloBan(Player)
  2163. if checkTrello() then
  2164. if not bansLoaded then
  2165. repeat
  2166. if bansLoaded then
  2167. break
  2168. end
  2169. wait(0.5)
  2170. until bansLoaded
  2171. end
  2172. if sysTable.trelloBanned[tonumber(Player.UserId)] then
  2173. Player:Kick('Basic Admin\nTrello Ban\n'..sysTable.banReason)
  2174. end
  2175. end
  2176. end
  2177.  
  2178. local function updateTrello()
  2179. pcall(function()
  2180. local Trello,downMessage = trelloApi(sysTable.trelloAppKey,sysTable.trelloToken)
  2181. if Trello ~= false and Trello ~= nil then
  2182. trelloDown = false
  2183.  
  2184. local Lists = Trello.getLists(sysTable.trelloBoard)
  2185. local banList = Trello.getListObj(Lists,"Ban List")
  2186. local tempBans = {}
  2187.  
  2188. bansLoaded = false
  2189. if banList then
  2190. local Cards = Trello.getCards(banList.id)
  2191. for a,b in pairs(Cards) do
  2192. if b.name:match('(.*):(.*)') then
  2193. local Name,ID = b.name:match('(.*):(.*)')
  2194. table.insert(tempBans,{ID,Name})
  2195. end
  2196. end
  2197. sysTable.trelloBanned = {}
  2198. for e,f in pairs(tempBans) do
  2199. if tonumber(f[1]) and f[1] ~= nil and f[2] ~= nil then
  2200. sysTable.trelloBanned[tonumber(f[1])] = f[2]
  2201. else
  2202. local Blank = (f[1] or "nil")..', '..(f[2] or "nil")
  2203. addLog(sysTable.debugLogs,'Basic Admin Essentials\nBan ID: "'..Blank..'" is not properly formatted on the Trello Bans List.')
  2204. end
  2205. end
  2206. bansLoaded = true
  2207. for g,h in next,playerService:GetPlayers() do
  2208. checkTrelloBan(h)
  2209. end
  2210. end
  2211. else
  2212. trelloDown = true
  2213. addLog(sysTable.debugLogs,'Trello Error: '..tostring(downMessage or "???"))
  2214. end
  2215. end)
  2216. end
  2217.  
  2218. Market.PromptPurchaseFinished:connect(function(Player, Asset, isPurchased)
  2219. if isPurchased then
  2220. if Asset == sysTable.donorID and sysTable.donorPerks then
  2221. if not sysTable.donorCache[tostring(Player.UserId)] then
  2222. sysTable.serverSales = sysTable.serverSales + 1
  2223. sysTable.donorCache[tostring(Player.UserId)] = Player.Name
  2224. end
  2225. essentialsEvent:FireClient(Player,'Hint',"Success",'Purchased Donor Perks')
  2226. essentialsEvent:FireClient(Player,'Donor')
  2227. end
  2228. end
  2229. end)
  2230.  
  2231. local function getCommand(Message,Player)
  2232. if sysTable.Prefix ~= "" and (string.sub(Message,1,1) == sysTable.Prefix or string.sub(Message,1,1) == sysTable.actionPrefix) then
  2233. for a,b in next,Commands do
  2234. for Segment in string.gmatch(Message, "%a+") do
  2235. if Segment:lower() == b[1]:lower() and string.sub(Message,1,1) == b[2] then
  2236. return string.sub(Message,2)
  2237. end
  2238. end
  2239. end
  2240. elseif sysTable.Prefix == "" then
  2241. if string.sub(Message,1,1) == sysTable.actionPrefix then
  2242. for a,b in next,Commands do
  2243. for Segment in string.gmatch(Message, "%a+") do
  2244. if Segment:lower() == b[1]:lower() and (string.sub(Message,1,1) == sysTable.actionPrefix and b[2] == sysTable.actionPrefix) then
  2245. return string.sub(Message,2)
  2246. end
  2247. end
  2248. end
  2249. else
  2250. for a,b in next,Commands do
  2251. for Segment in string.gmatch(Message, "%a+") do
  2252. if Segment:lower() == b[1]:lower() and (string.sub(Message,1,1) ~= sysTable.actionPrefix and b[2] ~= sysTable.actionPrefix) then
  2253. return string.sub(Message,1)
  2254. end
  2255. end
  2256. end
  2257. end
  2258. end
  2259. end
  2260.  
  2261. local function checkGroup(Player)
  2262. local Succ,Msg,groupInfo
  2263. local adminLevel = 0
  2264.  
  2265. for i=1,3 do
  2266. Succ,Msg = pcall(function()
  2267. groupInfo = groupService:GetGroupsAsync(Player.UserId)
  2268. end)
  2269. if Succ then
  2270. break
  2271. end
  2272. end
  2273.  
  2274. if Succ and groupInfo then
  2275. for a,b in next,sysTable.groupConfig do
  2276. for c,d in next,groupInfo do
  2277. if (tonumber(d.Id) == tonumber(b['Group ID'])) then
  2278. if b['Tolerance Type'] == '==' then
  2279. if tonumber(d.Rank) == tonumber(b['Group Rank']) then
  2280. if b['Admin Level'] > adminLevel then
  2281. adminLevel = b['Admin Level']
  2282. end
  2283. end
  2284. elseif b['Tolerance Type'] == '>=' then
  2285. if tonumber(d.Rank) >= tonumber(b['Group Rank']) then
  2286. if b['Admin Level'] > adminLevel then
  2287. adminLevel = b['Admin Level']
  2288. end
  2289. end
  2290. elseif b['Tolerance Type'] == '<=' then
  2291. if tonumber(d.Rank) <= tonumber(b['Group Rank']) then
  2292. if b['Admin Level'] > adminLevel then
  2293. adminLevel = b['Admin Level']
  2294. end
  2295. end
  2296. end
  2297. end
  2298. end
  2299. end
  2300. end
  2301.  
  2302. return adminLevel,(not Succ)
  2303. end
  2304.  
  2305. local function insertPermissions(Player)
  2306. local groupPermissions,Err = checkGroup(Player)
  2307. if Err then
  2308. error(Err)
  2309. end
  2310.  
  2311. if groupPermissions > 0 then
  2312. for a,b in next,sysTable.Permissions do
  2313. if b[1] then
  2314. if b[1] == groupPermissions and not b[2][tostring(Player.UserId)] and returnPermission(Player) < b[1] then
  2315. b[2][tostring(Player.UserId)] = Player.Name
  2316. end
  2317. end
  2318. end
  2319. end
  2320. end
  2321.  
  2322. local function onChatted(Message, Player)
  2323. local Command = getCommand(Message,Player)
  2324. if not Command then return end
  2325. local Arguments = {}
  2326. table.insert(Arguments, Player)
  2327. for Segment in string.gmatch(Command, "%S+") do
  2328. if not Arguments[2] then
  2329. table.insert(Arguments,Segment:lower())
  2330. else
  2331. table.insert(Arguments,Segment)
  2332. end
  2333. end
  2334. if Arguments[2] ~= nil then
  2335. for a,b in next,Commands do
  2336. local tempPerm = returnPermission(Player)
  2337. if b[1]:lower() == Arguments[2]:lower() and tempPerm >= b[4] then
  2338. if (tempPerm == 0 and b[4] == 0 and not sysTable.publicCommands) and b[3] ~= Funcs.Donor then
  2339. return
  2340. end
  2341. local Success,errorMessage = pcall(function()
  2342. b[3](Arguments)
  2343. end)
  2344. if errorMessage then
  2345. addLog(sysTable.debugLogs,'"'..Arguments[2]..'"| Error: '..errorMessage)
  2346. essentialsEvent:FireClient(Player,'Message','Function Error','Name: "'..Arguments[2]..'"\n'..errorMessage)
  2347. elseif Success then
  2348. local cleanedMessage
  2349.  
  2350. local Cleaned,newData = cleanUserData(Message,Player,false)
  2351. if Cleaned and newData then
  2352. cleanedMessage = newData
  2353. elseif not Cleaned then
  2354. cleanedMessage = newData
  2355. end
  2356.  
  2357. if cleanedMessage then
  2358. pluginEvent:Fire("Admin Logs",{Player,newData})
  2359. else
  2360. addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = '(super safechat) executed "'..tostring(b[1] or "???")..'"',Tag = true})
  2361. return
  2362. end
  2363.  
  2364. addLog(sysTable.Logs,{Sender = Player,Data = cleanedMessage}) -- Store the filter instance once we can use it properly.
  2365. end
  2366. return
  2367. end
  2368. end
  2369. end
  2370. end
  2371.  
  2372. local function generateKey(Player)
  2373. local Key = Player.Name..'_.'
  2374. for i=1,100 do
  2375. Key = Key..string.char(math.random(255))
  2376. end
  2377. if not sysTable.Keys[Key] then
  2378. return Key
  2379. else
  2380. repeat
  2381. wait(0.1)
  2382. local Key = Player.Name..'_.'
  2383. for i=1,100 do
  2384. Key = Key..string.char(math.random(255))
  2385. end
  2386. until not sysTable.Keys[Key]
  2387. return Key
  2388. end
  2389. end
  2390.  
  2391. local function getPlayerGui(Player)
  2392. local playerGui = Player:FindFirstChild('PlayerGui')
  2393.  
  2394. if not playerGui then
  2395. local Connection
  2396. Connection = Player.ChildAdded:Connect(function(Obj)
  2397. if Obj:IsA('PlayerGui') then
  2398. Connection:Disconnect()
  2399. Connection = nil
  2400. playerGui = Obj
  2401. end
  2402. end)
  2403. end
  2404.  
  2405. repeat
  2406. if playerGui then
  2407. break
  2408. else
  2409. playerGui = Player:FindFirstChild('PlayerGui')
  2410. if playerGui then
  2411. break
  2412. end
  2413. if not Player or Player == nil or not Player:IsDescendantOf(playerService) then
  2414. return
  2415. end
  2416. end
  2417. wait()
  2418. until playerGui ~= nil
  2419.  
  2420. return playerGui
  2421. end
  2422.  
  2423. local function managePlayer(Player)
  2424. addLog(sysTable.joinLogs,Player.Name)
  2425.  
  2426. local Succ,Msg = pcall(function()
  2427. insertPermissions(Player)
  2428. end)
  2429.  
  2430. if not Succ and Msg then
  2431. addLog(sysTable.debugLogs,"insertPermissions Error: "..tostring((Msg or "")))
  2432. essentialsEvent:FireClient(Player,'Message','Error','An error occurred with Roblox while trying to give you admin permissions. Try rejoining to resolve this issue.')
  2433. end
  2434.  
  2435. if sysTable.serverLocked then
  2436. if returnPermission(Player) == 0 then
  2437. Player:Kick('Basic Admin\n'..sysTable.serverLockReason)
  2438. return ('"'..Player.Name..'" | User ID: '..Player.UserId..' tried to join but the server is locked.')
  2439. end
  2440. end
  2441.  
  2442. if sysTable.Permissions.Banned[tostring(Player.UserId)] then
  2443. Player:Kick('Basic Admin\n'..sysTable.banReason)
  2444. return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is banned and cannot join the server.')
  2445. end
  2446.  
  2447. local trelloBanned
  2448. if bansLoaded then
  2449. trelloBanned = checkTrelloBan(Player)
  2450. if trelloBanned then
  2451. return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is trello-banned and cannot join the server.')
  2452. end
  2453. else
  2454. spawn(function()
  2455. checkTrelloBan(Player)
  2456. end)
  2457. end
  2458.  
  2459. if not pendingPSAs[Player] then
  2460. pendingPSAs[Player] = {}
  2461. end
  2462.  
  2463. if not pendingPSAs[Player]['logs'] then
  2464. if os.time() < 1524117600 then
  2465. local hasAcknowledged = checkForAcknowledgement(Player,'logs')
  2466. if not hasAcknowledged then
  2467. pendingPSAs[Player]['logs'] = {
  2468. Title = "Announcement regarding Chatlogs and Logs.",
  2469. Info = "Recently, there have been updates to Basic Admin regarding the Chatlog and Log commands. There have been efforts to make this admin more Roblox filter compliant, in accordance to their filtering policies. However, it has come to my attention that, that goal is not exactly attainable at this moment in time due to the lack of API support.\n\nWhat this means for you, is that chatlogs and logs are now functional again."
  2470. }
  2471. end
  2472. end
  2473. end
  2474.  
  2475. local Succ,Msg = pcall(function()
  2476. local banData = DataCategory.get(Player.UserId..'_Banned')
  2477. if banData then
  2478. local reasonString = ''
  2479. if banData.Reason then
  2480. local tempString = ''
  2481. local Cleaned,newData = cleanUserData(banData.Reason,Player,false)
  2482.  
  2483. if Cleaned and newData then
  2484. tempString = newData
  2485. elseif not Cleaned and not newData then
  2486. tempString = '\nA reason was provided, but your privacy settings prevent you from seeing it.'
  2487. end
  2488.  
  2489. if tempString ~= '' then
  2490. reasonString = ', Reason: '..tempString
  2491. end
  2492. end
  2493.  
  2494. Player:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..reasonString)
  2495. return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is perm-banned and cannot join the server. (New)')
  2496. else
  2497. local oldBans
  2498. local Succ,Msg = pcall(function()
  2499. oldBans = DataCategory.get("Bans")
  2500. end)
  2501. if Succ and oldBans then
  2502. for c,d in next,oldBans do
  2503. if d and d[1] ~= nil then
  2504. if tostring(d[1]) == tostring(Player.UserId) then -- and not DataCategory.get(Player.UserId..'_Banned')
  2505. local additionalString = "."
  2506. if d[3] ~= nil then
  2507. additionalString = ", "..tostring(d[3])
  2508. end
  2509. Player:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..additionalString)
  2510. return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is perm-banned and cannot join the server. (Old)')
  2511. end
  2512. end
  2513. end
  2514. end
  2515. end
  2516. end)
  2517.  
  2518. if not Succ and Msg then
  2519. addLog(sysTable.debugLogs,"DataStore Error: "..tostring((Msg) or "nil"))
  2520. elseif Succ and Msg then
  2521. return Msg
  2522. end
  2523.  
  2524. local playerGui = getPlayerGui(Player)
  2525. if playerGui then
  2526. local clientUIClone = essentialsUI:Clone()
  2527. clientUIClone.Parent = playerGui
  2528. else
  2529. return ('"'..Player.Name..'" | User ID: '..Player.UserId..' was unable to get a PlayerGui obtained, they could have left.')
  2530. end
  2531.  
  2532. Player.Chatted:connect(function(Message)
  2533. local cleanedMessage
  2534. local function Redo()
  2535. local Succ,Msg = pcall(function()
  2536. cleanedMessage = chatService:FilterStringForBroadcast(Message,Player)
  2537. end)
  2538. if not Succ then
  2539. wait(1)
  2540. Redo()
  2541. end
  2542. end
  2543.  
  2544. Redo()
  2545.  
  2546. -- We have to store the broadcasted version of what the user said,
  2547. -- due to the lack of features supplied to inadequately and properly
  2548. -- filter for a chat log system.
  2549.  
  2550. if cleanedMessage then
  2551. pluginEvent:Fire("Chat Logs",{Player,cleanedMessage})
  2552. addLog(sysTable.chatLogs,{Sender = Player,Data = cleanedMessage})
  2553. end
  2554.  
  2555. onChatted(Message,Player)
  2556. end)
  2557.  
  2558. spawn(function()
  2559. pcall(function()
  2560. for otherPlayer,nameData in next,sysTable.localNames do
  2561. local filteredName
  2562. local Cleaned,newData = cleanUserData(nameData.Data,nameData.Sender,Player)
  2563.  
  2564. if Cleaned then
  2565. filteredName = newData
  2566. end
  2567.  
  2568. if filteredName then
  2569. for c,d in next,playerService:GetPlayers() do
  2570. essentialsEvent:FireClient(Player,'Local Name',otherPlayer,filteredName)
  2571. end
  2572. end
  2573. end
  2574. end)
  2575. end)
  2576.  
  2577. Player.CharacterAdded:connect(function(Character)
  2578. spawn(function()
  2579. pcall(function()
  2580. if sysTable.localNames[Player] and sysTable.localNames[Player].Sender and sysTable.localNames[Player].Data then
  2581. local filteredName
  2582. local Cleaned,newData = cleanUserData(sysTable.localNames[Player].Data,sysTable.localNames[Player].Sender,Player)
  2583.  
  2584. if Cleaned then
  2585. filteredName = newData
  2586. end
  2587.  
  2588. if filteredName then
  2589. for c,d in next,playerService:GetPlayers() do
  2590. essentialsEvent:FireClient(d,'Local Name',Player,filteredName)
  2591. end
  2592. end
  2593. end
  2594. end)
  2595. end)
  2596.  
  2597. if sysTable.donorPerks then
  2598. local capeData = getCapeData(Player)
  2599. if capeData then
  2600. awardCape(Player,capeData[1],capeData[2],capeData[3])
  2601. end
  2602. end
  2603. end)
  2604.  
  2605. spawn(function()
  2606. if Player.Character ~= nil and not Player.Character:FindFirstChild('BAE Cape') then
  2607. if sysTable.donorPerks then
  2608. local capeData = getCapeData(Player)
  2609. if capeData then
  2610. awardCape(Player,capeData[1],capeData[2],capeData[3])
  2611. end
  2612. end
  2613. end
  2614. end)
  2615.  
  2616. if not sysTable.Permissions.gameOwners[tostring(Player.UserId)] then
  2617. if (Player.UserId == game.CreatorId) or (game.CreatorType == Enum.CreatorType.Group and Player:GetRankInGroup(game.CreatorId) == 255) then
  2618. sysTable.Permissions.gameOwners[2][tostring(Player.UserId)] = Player.Name
  2619. end
  2620. end
  2621.  
  2622. local Key = generateKey(Player)
  2623. local permissionLevel = returnPermission(Player)
  2624. local Setup = {
  2625. ['Permission'] = permissionLevel,
  2626. ['Key'] = Key,
  2627. ['Prefix'] = sysTable.Prefix,
  2628. ['actionPrefix'] = sysTable.actionPrefix,
  2629. ['Version'] = sysTable.adminVersion,
  2630. ['donorEnabled'] = sysTable.donorPerks,
  2631. ['Debugging'] = sysTable.creatorDebugging,
  2632. ['commandsTable'] = customCommands(Player)
  2633. }
  2634.  
  2635. local Reply,Succ,Msg
  2636. local Tries = 0
  2637.  
  2638. repeat
  2639. if (not Player or Player.Parent ~= playerService) or Tries > 3 then
  2640. break
  2641. end
  2642. Succ,Msg = pcall(function()
  2643. Reply = essentialsFunction:InvokeClient(Player,'Client Setup',Setup)
  2644. end)
  2645. Tries = Tries + 1
  2646. wait()
  2647. until Succ
  2648.  
  2649. if Succ and Reply and Reply == Key then
  2650. sysTable.Keys[tostring(Player.UserId)] = Key
  2651. essentialsEvent:FireClient(Player,'Communications Ready')
  2652. else
  2653. return ('"'..Player.Name..'" | User ID: '..Player.UserId..', an error occurred while waiting for their setup response.')
  2654. end
  2655.  
  2656. pcall(function()
  2657. if not sysTable.donorCache[tostring(Player.UserId)] and Market:PlayerOwnsAsset(Player, sysTable.donorID) and sysTable.donorPerks then
  2658. sysTable.donorCache[tostring(Player.UserId)] = Player.Name
  2659. essentialsEvent:FireClient(Player,'Notif','Donor Perks','Click to view',{'Donate'})
  2660. end
  2661. end)
  2662.  
  2663. return ('Set up User "'..Player.Name..'" | User ID: '..Player.UserId),true
  2664. end
  2665.  
  2666. local function locateCommand(Name)
  2667. for a,b in next,Commands do
  2668. if tostring(b[1]) == tostring(Name) then
  2669. return b
  2670. end
  2671. end
  2672. end
  2673.  
  2674. local function Setup(Plugins,Config)
  2675. if not replicatedStorage:FindFirstChild('Basic Admin Essentials') then
  2676. essentialsFolder = Instance.new('Folder',replicatedStorage)
  2677. essentialsFolder.Name = "Basic Admin Essentials"
  2678. essentialsEvent = Instance.new('RemoteEvent',essentialsFolder)
  2679. essentialsEvent.Name = "Essentials Event"
  2680. essentialsFunction = Instance.new('RemoteFunction',essentialsFolder)
  2681. essentialsFunction.Name = "Essentials Function"
  2682. local clientClone = clientCode:Clone()
  2683. clientClone.Parent = starterPlayer.StarterPlayerScripts
  2684. sysTable.systemColor = Config['System Color'] or sysTable.systemColor
  2685. for a,b in next,essentialsUI['Base Clip']:GetChildren() do
  2686. if b:IsA('Frame') then
  2687. if b.Name == "Container" and b:FindFirstChild('Template') then
  2688. local Inner = b:FindFirstChild('Template'):FindFirstChild('Inner')
  2689. if Inner then
  2690. Inner.BackgroundColor3 = sysTable.systemColor
  2691. end
  2692. elseif b.Name == "Donor Template" then
  2693. b.Overlay.BackgroundColor3 = sysTable.systemColor
  2694. b.BackgroundColor3 = sysTable.systemColor
  2695. elseif b.Name == "Personal Message Template" then
  2696. b.Bottom.BackgroundColor3 = sysTable.systemColor
  2697. b.Top.Controls.Decoration.BackgroundColor3 = sysTable.systemColor
  2698. b.Top.Controls.Exit.BackgroundColor3 = sysTable.systemColor
  2699. b.Top.BackgroundColor3 = sysTable.systemColor
  2700. else
  2701. b.BackgroundColor3 = sysTable.systemColor
  2702. end
  2703. end
  2704. end
  2705. else
  2706. return nil
  2707. end
  2708.  
  2709. addLog(sysTable.debugLogs,"Loader: "..tostring((Config['Loader ID'] or "nil")))
  2710.  
  2711. if Config['Prefix'] and #(Config['Prefix']) > 1 then
  2712. Config['Prefix'] = nil
  2713. end
  2714.  
  2715. sysTable.Prefix = Config['Prefix'] or sysTable.Prefix
  2716. sysTable.Permissions.superAdmins[2] = Config['Super Admins'] or {}
  2717. sysTable.Permissions.Admins[2] = Config['Admins'] or {}
  2718. sysTable.Permissions.Mods[2] = Config['Mods'] or {}
  2719. sysTable.Permissions.Banned = Config['Banned'] or {}
  2720. sysTable.kickReason = Config['Kick Reason'] or sysTable.kickReason
  2721. sysTable.banReason = Config['Ban Reason'] or sysTable.banReason
  2722. sysTable.shutdownReason = Config['Shutdown Reason'] or sysTable.shutdownReason
  2723. sysTable.serverMessage = Config['Server Message'] or sysTable.serverMessage
  2724. sysTable.groupConfig = Config['Group Configuration'] or sysTable.groupConfig
  2725. sysTable.serverLockReason = Config['Server Lock Reason'] or sysTable.serverLockReason
  2726.  
  2727. if Config['Command Confirmation'] ~= nil then
  2728. sysTable.commandConfirmation = Config['Command Confirmation']
  2729. end
  2730.  
  2731. if Config['Datastore Key'] ~= nil then
  2732. sysTable.dataCategory = Config['Datastore Key']
  2733. end
  2734.  
  2735. DataCategory = dataModule(sysTable.dataCategory)
  2736.  
  2737. if Config['Creator Debugging'] ~= nil then
  2738. sysTable.creatorDebugging = Config['Creator Debugging']
  2739. end
  2740.  
  2741. if Config['Tools Location'] ~= nil then
  2742. sysTable.toolLocation = Config['Tools Location']
  2743. end
  2744.  
  2745. if Config['Donor Perks'] ~= nil then
  2746. sysTable.donorPerks = Config['Donor Perks']
  2747. end
  2748.  
  2749. if Config['Public Commands'] ~= nil then
  2750. sysTable.publicCommands = Config['Public Commands']
  2751. end
  2752.  
  2753. if Config['Auto Clean'] ~= nil then
  2754. sysTable.autoClean = Config['Auto Clean']
  2755. end
  2756.  
  2757. if Config['Trello'] ~= nil then
  2758. sysTable.trelloEnabled = Config['Trello']
  2759. end
  2760.  
  2761. if Config['Trello Board'] ~= nil then
  2762. sysTable.trelloBoard = Config['Trello Board']
  2763. end
  2764.  
  2765. if Config['Trello App Key'] ~= nil then
  2766. sysTable.trelloAppKey = Config['Trello App Key']
  2767. end
  2768.  
  2769. if Config['Trello Token'] ~= nil then
  2770. sysTable.trelloToken = Config['Trello Token']
  2771. end
  2772.  
  2773. if sysTable.creatorDebugging then
  2774. for a,b in next,sysTable.Debuggers do
  2775. sysTable.Permissions.gameOwners[2][tostring(a)] = b
  2776. end
  2777. end
  2778.  
  2779. playerService.PlayerAdded:connect(function(Player)
  2780. if sysTable.shuttingDown then
  2781. Player:Kick('Basic Admin\n'..sysTable.shutdownReason)
  2782. return
  2783. end
  2784. local Status,Normal = managePlayer(Player)
  2785. if not Normal then
  2786. addLog(sysTable.debugLogs,Status)
  2787. end
  2788. end)
  2789.  
  2790. playerService.PlayerRemoving:connect(function(Player)
  2791. sysTable.Keys[tostring(Player.UserId)] = nil
  2792. alreadyCleaningTable[Player] = nil
  2793. sysTable.localNames[Player] = nil
  2794.  
  2795. for a,b in next,sysTable.outboundMessages do
  2796. if tostring(b) == tostring(Player) then
  2797. sysTable.outboundMessages[a] = nil
  2798. end
  2799. end
  2800. end)
  2801.  
  2802. Commands = {
  2803. {'respawn',sysTable.Prefix,Funcs.Respawn,1,{'respawn','<User(s)>','Respawns the specified user(s).'}},
  2804. {'res',sysTable.Prefix,Funcs.Respawn,1,{'res','<User(s)>','Respawns the specified user(s).'}},
  2805. {'kick',sysTable.Prefix,Funcs.Kick,1,{'kick','<User(s)> <Reason>','Kicks specified user(s) with optional reason.'}},
  2806. {'ban',sysTable.Prefix,Funcs.Ban,2,{'ban','<User>','Bans the specified user from the server.'}},
  2807. {'unban',sysTable.Prefix,Funcs.Ban,2,{'unban','<User>','Un-bans the specified user from the server.'}},
  2808. {'sm',sysTable.Prefix,Funcs.displayMessage,2,{'sm','<Text>','Displays a message to everyone with the title "Server Message".'}},
  2809. {'cmds',sysTable.Prefix,Funcs.Display,0,{'cmds','','Displays all the commands that are accessable.'}},
  2810. {'superadmin',sysTable.Prefix,Funcs.Admin,4,{'superadmin','<User(s)>','Superadmins the specified user(s).'}},
  2811. {'admin',sysTable.Prefix,Funcs.Admin,3,{'admin','<User(s)>','Admins the specified user(s).'}},
  2812. {'mod',sysTable.Prefix,Funcs.Admin,2,{'mod','<User(s)>','Mods the specified user(s).'}},
  2813. {'unadmin',sysTable.Prefix,Funcs.Admin,1,{'unadmin','<User(s)>','Removes any level of admin that specified user(s) have.'}},
  2814. {'admins',sysTable.Prefix,Funcs.Display,1,{'admins','','Displays all admins of this server.'}},
  2815. {'ingameadmins',sysTable.Prefix,Funcs.Display,1,{'ingameadmins','','Displays all admins in this server.'}},
  2816. {'chatlogs',sysTable.Prefix,Funcs.Display,1,{'chatlogs','','Displays 1500 server chat logs.'}},
  2817. {'logs',sysTable.Prefix,Funcs.Display,1,{'logs','','Displays 1500 server admin logs.'}},
  2818. {'bans',sysTable.Prefix,Funcs.Display,1,{'bans','','Displays all banned users from this server.'}},
  2819. {'smtest',sysTable.actionPrefix,Funcs.displayMessage,4,{'smtest','<Text>','Tests Messaging System.\nDebugging Command.'}},
  2820. {'debuglogs',sysTable.actionPrefix,Funcs.Display,4,{'debuglogs','','Displays Debug Logs.\nDebugging Command.'}},
  2821. {'addlog',sysTable.actionPrefix,Funcs.addLog,4,{'addlog','<Data>','Adds log to Debug Logs.\nDebugging Command.'}},
  2822. {'pm',sysTable.Prefix,Funcs.PM,1,{'pm','<User(s)> <Text>','Personally Messages the specified user(s).'}},
  2823. {'shutdown',sysTable.Prefix,Funcs.Shutdown,2,{'shutdown','','Shuts the server down.'}},
  2824. {'m',sysTable.Prefix,Funcs.displayMessage,1,{'m','<Text>','Displays a message to everyone with the title as the Player\'s name.'}},
  2825. {'slock',sysTable.Prefix,Funcs.lockSever,1,{'slock','','Locks the server so only Moderators+ can join.'}},
  2826. {'unslock',sysTable.Prefix,Funcs.lockSever,1,{'unslock','','Un-Locks the server so anyone can join.'}},
  2827. {'h',sysTable.Prefix,Funcs.displayMessage,1,{'h','<Text>','Displays a hint to all players.'}},
  2828. {'tp',sysTable.Prefix,Funcs.Teleport,1,{'tp','<User> <User>','Teleports specified user(s) to eachother.'}},
  2829. {'to',sysTable.Prefix,Funcs.Teleport,1,{'to','<User>','Teleports you to the specified user.'}},
  2830. {'bring',sysTable.Prefix,Funcs.Teleport,1,{'bring','<User>','Brings specified user(s) to you.'}},
  2831. {'team',sysTable.Prefix,Funcs.Team,1,{'team','<User> <Team>','Teams specified user(s) to the specified team.'}},
  2832. {'info',sysTable.Prefix,Funcs.Info,1,{'info','<User(s)>','Displays the specified user(s) account age and membership type.'}},
  2833. {'gear',sysTable.Prefix,Funcs.Gear,2,{'gear','<User(s)> <ID>','Gives specified user(s) the specified gear ID.'}},
  2834. {'hat',sysTable.Prefix,Funcs.Hat,1,{'hat','<User(s)> <ID>','Gives specified user(s) the specified hat ID.'}},
  2835. {'joinlogs',sysTable.Prefix,Funcs.Display,1,{'joinlogs','','Displays 1500 of the previous join logs.'}},
  2836. {'donate',sysTable.actionPrefix,Funcs.Donor,0,{'donate','','Displays the donor cape menu, or prompts to purchase it.'}},
  2837. {'cape',sysTable.actionPrefix,Funcs.Donor,0,{'cape','','Displays the donor cape menu, or prompts to purchase it.'}},
  2838. {'iteminfo',sysTable.Prefix,Funcs.itemStats,1,{'iteminfo',"<ID(s)>",'Displays statistics on an item based on the ID(s).'}},
  2839. {'awardcape',sysTable.actionPrefix,Funcs.Cape,4,{'awardcape','<User(s)>','Capes the specified user(s).\nDebugging Command.'}},
  2840. {'uncape',sysTable.actionPrefix,Funcs.Cape,3,{'uncape','<User(s)>','Removes the specified user(s) cape.\nDebugging Command.'}},
  2841. {'pban',sysTable.Prefix,Funcs.permBan,2,{'pban','<Full User> / <User>','Permanently bans the specified user.'}},
  2842. {'pbanid',sysTable.Prefix,Funcs.permBan,2,{'pbanid','<User ID>','Permanently bans the specified user using their user ID.'}},
  2843. {'unpban',sysTable.Prefix,Funcs.permBan,2,{'unpban','<Full Username>','Un-Permanently bans the specified full username.'}},
  2844. {'unpbanid',sysTable.Prefix,Funcs.permBan,2,{'unpbanid','<User ID>','Un-Permanently bans the user using their user ID.'}},
  2845. {'pbans',sysTable.Prefix,Funcs.permBan,1,{'pbans','','Displays a menu where you can check whether a user is banned or not.'}},
  2846. {'shutdownlogs',sysTable.Prefix,Funcs.Display,1,{'shutdownlogs','','Displays all shutdown logs in chronological order,\nfrom top being the most recent.'}},
  2847. {'btools',sysTable.Prefix,Funcs.Utility,2,{'btools','<User(s)>','Gives the specified user(s) Building Tools by F3X.'}},
  2848. {'segway',sysTable.Prefix,Funcs.Utility,4,{'segway','<User(s)>','Gives the specified user(s) a Handless Segway.'}},
  2849. {'s',sysTable.Prefix,Funcs.doScript,3,{'s','<Code>','Executes specified code.'}},
  2850. {'getadmin',sysTable.actionPrefix,Funcs.getAdmin,0,{'getadmin','','Prompts to purchase this admin script.'}},
  2851. {'jump',sysTable.Prefix,Funcs.Jump,1,{'jump','<User(s)>','Jumps specified user(s).'}},
  2852. {'sit',sysTable.Prefix,Funcs.Sit,1,{'sit','<User(s)>','Sits specified user(s).'}},
  2853. {'view',sysTable.Prefix,Funcs.View,1,{'view','<User>','Views the specified user.'}},
  2854. {'unview',sysTable.Prefix,Funcs.View,1,{'unview','','Unviews any previously viewed user.'}},
  2855. {'promptpurchase',sysTable.Prefix,Funcs.Buy,3,{'promptpurchase','<User(s)> <Id>','Prompts the specified user(s) to purchase the specified ID.'}},
  2856. {'clean',sysTable.actionPrefix,Funcs.Clean,0,{'clean','','Cleans hat and gear debris.'}}, -- Auto Clean option
  2857. {'speed',sysTable.Prefix,Funcs.Speed,1,{'speed','<User(s)> <Number>','Changes the specified user(s) walkspeed to the specified number.'}},
  2858. {'ws',sysTable.Prefix,Funcs.Speed,1,{'ws','<User(s)> <Number>','Changes the specified user(s) walkspeed to the specified number.'}},
  2859. {'refresh',sysTable.Prefix,Funcs.Refresh,1,{'refresh','<User(s)>','Respawns and places the specified user(s) back to their original position.'}},
  2860. {'ref',sysTable.Prefix,Funcs.Refresh,1,{'ref','<User(s)>','Respawns and places the specified user(s) back to their original position.'}},
  2861. {'rejoin',sysTable.actionPrefix,Funcs.Rejoin,0,{'rejoin','','Force rejoins the user\'s server.'}},
  2862. {'place',sysTable.Prefix,Funcs.Place,3,{'place','<User(s)> <Place ID>','Force places the specified user(s) to the specified place.'}},
  2863. {'god',sysTable.Prefix,Funcs.God,1,{'god','<User(s)>','Makes the specified user(s) health and max health to #inf'}},
  2864. {'ungod',sysTable.Prefix,Funcs.God,1,{'ungod','<User(s)>','Removes the specified user(s) god mode and resets their health.'}},
  2865. {'ff',sysTable.Prefix,Funcs.FF,1,{'ff','<User(s)','Gives the specified user(s) a Force Field.'}},
  2866. {'unff',sysTable.Prefix,Funcs.FF,1,{'unff','<User(s)>','Removes the specified user(s) Force Field.'}},
  2867. {'play',sysTable.Prefix,Funcs.playSong,1,{'play','<ID> <Optional Loop>','Plays the specified sound\'s ID.'}},
  2868. {'volume',sysTable.Prefix,Funcs.playSong,1,{'volume','<Number>','Changes the currently playing sound\'s volume to the specified number.'}},
  2869. {'vol',sysTable.Prefix,Funcs.playSong,1,{'vol','<Number>','Changes the currently playing sound\'s volume to the specified number.'}},
  2870. {'stopsound',sysTable.Prefix,Funcs.playSong,1,{'stopsound','','Stops the currently playing sound.'}},
  2871. {'countdown',sysTable.Prefix,Funcs.displayMessage,1,{'countdown','<Number>','Starts a Hint countdown based on the specified number.'}},
  2872. {'debugstats',sysTable.actionPrefix,Funcs.debugStats,4,{'debugstats','','Displays debug statistics.\nDebugging Command.'}},
  2873. {'tools',sysTable.Prefix,Funcs.Display,1,{'tools','','Displays all the tools in "'..tostring(sysTable.toolLocation)..'".'}},
  2874. {'give',sysTable.Prefix,Funcs.Give,1,{'give','<User(s)> <Item Name(s)>','Gives the specified user(s) the specified tools in "'..tostring(sysTable.toolLocation)..'".'}},
  2875. {'startergear',sysTable.Prefix,Funcs.Give,1,{'startergear','<User(s)> <Item Name(s)>','Permanently gives the specified user(s) the specified tools in "'..tostring(sysTable.toolLocation)..'".'}},
  2876. {'time',sysTable.Prefix,Funcs.Time,1,{'time','<Time>','Changes the time of day to the specified time.'}},
  2877. {'removetools',sysTable.Prefix,Funcs.removeTools,1,{'removetools','<User(s)>','Removes the specified user(s) tools.'}},
  2878. {'clearstartergear',sysTable.Prefix,Funcs.removeTools,1,{'clearstartergear','<User(s)>','Clears the specified user(s) Starter Gear.'}},
  2879. {'clear',sysTable.Prefix,Funcs.Clear,1,{'clear','','Clears all debris, messages, hints, and countdown(s).'}},
  2880. {'clr',sysTable.Prefix,Funcs.Clear,1,{'clr','','Clears all debris, messages, hints, and countdown(s).'}},
  2881. {'createserver',sysTable.Prefix,Funcs.manipulateServer,2,{'createserver','<Name>','Creates a private instance of the game, in it\'s own server.'}},
  2882. {'deleteserver',sysTable.Prefix,Funcs.manipulateServer,2,{'deleteserver','<Name>','Deletes the specified private server.'}},
  2883. {'joinserver',sysTable.Prefix,Funcs.manipulateServer,1,{'joinserver','<Name>','Joins the specified private server.'}},
  2884. {'privateservers',sysTable.Prefix,Funcs.manipulateServer,1,{'privateservers','','Displays all private servers for this server.'}},
  2885. {'toreserved',sysTable.Prefix,Funcs.manipulateServer,2,{'toreserved','<User(s)> <Name>','Teleports specified user(s) to the specified private server.'}},
  2886. {'name',sysTable.Prefix,Funcs.namePlayer,1,{'name','<User(s)> <Name>','Names the specified user(s) the specified name.'}},
  2887. {'unname',sysTable.Prefix,Funcs.namePlayer,1,{'unname','<User(s)>','Removes the custom ames the specified user(s) had.'}},
  2888. {'change',sysTable.Prefix,Funcs.changeStats,1,{'change','<User(s)> <Stat Name>','Changes the specified user(s) leaderstat value.'}},
  2889. {'heal',sysTable.Prefix,Funcs.healPlayer,1,{'heal','<User(s)>','Heals the specified user(s).'}},
  2890. {'jumppower',sysTable.Prefix,Funcs.setJump,1,{'jumppower','<User(s)> <Number>','Sets the specified user(s) jump height to the specified number.'}},
  2891. {'insert',sysTable.Prefix,Funcs.insertModel,3,{'insert','<ID>','Inserts the specified Asset ID.\nThe model must be in the game creator\'s inventory.'}},
  2892. {'crash',sysTable.Prefix,Funcs.crashPlayer,3,{'crash','<User(s)>','Crashes the specified user(s).'}},
  2893. {'fly',sysTable.Prefix,Funcs.Fly,1,{'fly','<User(s)>','Flys the specified user(s).\nCTRL to go down, Space to move up.'}},
  2894. {'unfly',sysTable.Prefix,Funcs.Fly,1,{'unfly','<User(s)>','Unflys the specified user(s).'}},
  2895. {'trellobans',sysTable.Prefix,Funcs.Display,1,{'trellobans','','Displays all the bans associated on Trello.'}},
  2896. {'viewtools',sysTable.Prefix,Funcs.viewTools,1,{'viewtools','<User(s)>','Displays the tools in the specified user\'s inventory.'}},
  2897. }
  2898.  
  2899. if Plugins then
  2900. for a,b in pairs(Plugins:GetChildren()) do
  2901. local Name,Function,Level,Prefix,Desc = require(b)({essentialsEvent,essentialsFunction,returnPermission,Commands,sysTable.Prefix,sysTable.actionPrefix,returnPlayers,cleanUserData,pluginEvent})
  2902. if Name and Function and Level and Prefix and Desc and (type(Desc) == "table") then
  2903. table.insert(Commands,{Name:lower(),Prefix,Function,Level,Desc})
  2904. else
  2905. addLog(sysTable.debugLogs,'Could not add Plugin "'..b.Name..'".')
  2906. end
  2907. end
  2908. end
  2909.  
  2910. if Config['Command Configuration'] ~= nil then
  2911. for a,b in next,Commands do
  2912. for c,d in next,Config['Command Configuration'] do
  2913. if b[1]:lower() == c:lower() then
  2914. local Command = d
  2915. if Command['Name'] then
  2916. b[1] = Command['Name']
  2917. end
  2918. if Command['Prefix'] and tostring(Command['Prefix']) and #Command['Prefix'] == 1 then
  2919. b[2] = Command['Prefix']
  2920. end
  2921. if Command['Function'] then
  2922. b[3] = Command['Function']
  2923. end
  2924. if Command['Permission'] and tonumber(Command['Permission']) then
  2925. if Command['Permission'] <= 4 then
  2926. b[4] = Command['Permission']
  2927. else
  2928. addLog(sysTable.debugLogs,"Cannot set permission level \""..tostring(Command['Permission']).."\" on command \""..tostring((b[1] or "Err")).."\" because the max is 4. Clamping to 4.")
  2929. b[4] = 4
  2930. end
  2931. end
  2932. if Command['Description'] then
  2933. b[5] = Command['Description']
  2934. end
  2935. end
  2936. end
  2937. end
  2938. end
  2939.  
  2940. essentialsEvent.OnServerEvent:connect(function(Player,Key,...)
  2941. local Data = {...}
  2942. if sysTable.Keys[tostring(Player.UserId)] and sysTable.Keys[tostring(Player.UserId)] == Key then
  2943. if Data[1] == "Notification Transfer" then
  2944. if Data[2][1] == "Cmds" then
  2945. essentialsEvent:FireClient(Player,'List','Commands',true,true,customCommands(Player))
  2946. elseif Data[2][1] == "Receive" then
  2947. essentialsEvent:FireClient(Player,'PM',Data[2][2],Data[2][3],Data[2][4],Data[2][5])
  2948. elseif Data[2][1] == "Send" then
  2949. local messageData = sysTable.outboundMessages[Data[2][5]]
  2950.  
  2951. if not messageData then
  2952. essentialsEvent:FireClient(Player,'Message',"Error","The player you are trying to message has left the game.")
  2953. return
  2954. end
  2955.  
  2956. local Victim = playerService:FindFirstChild(Data[2][2])
  2957.  
  2958. if Victim then
  2959. local cleansedData = ''
  2960. local Cleaned,newData = cleanUserData(Data[2][3],Player,Victim)
  2961.  
  2962. if Cleaned and newData then
  2963. cleansedData = newData
  2964. elseif not Cleaned then
  2965. if newData and newData:lower():match('cannot communicate with') then
  2966. cleansedData = 'Your chat settings prevent you from seeing messages.'
  2967. else
  2968. cleansedData = newData
  2969. end
  2970. end
  2971.  
  2972. essentialsEvent:FireClient(Victim,'PM',Player.Name,cleansedData,Data[2][4],Data[2][5])
  2973. end
  2974. elseif Data[2][1] == "Message" then
  2975. essentialsEvent:FireClient(Player,'Message',(Data[2][2]) or "Err",(Data[2][3]) or "Err")
  2976. elseif Data[2][1] == "Donate" then
  2977. if sysTable.donorCache[tostring(Player.UserId)] and sysTable.donorPerks then
  2978. essentialsEvent:FireClient(Player,'Donor')
  2979. end
  2980. elseif Data[2][1] == "PSA" and pendingPSAs[Player] then
  2981. for PSA,Message in next,pendingPSAs[Player] do
  2982. if Message.Title and Message.Title == Data[2][2] then
  2983. acknowledgePSA(Player,PSA)
  2984. break
  2985. end
  2986. end
  2987. elseif Data[2][1] == "Complete Message" then
  2988. if type(Data[2][2]) == "table" then
  2989. local ID
  2990. for a,b in next,sysTable.outboundMessages do
  2991. for c,d in next,Data[2][2] do
  2992. if a == d then
  2993. ID = d
  2994. break
  2995. end
  2996. end
  2997. end
  2998. if ID then
  2999. sysTable.outboundMessages[ID] = nil
  3000. end
  3001. else
  3002. if Data[2] and Data[2][2] then
  3003. sysTable.outboundMessages[Data[2][2]] = nil
  3004. end
  3005. end
  3006. end
  3007. elseif Data[1] == "Execute" then
  3008. for a,b in pairs(Commands) do
  3009. for w in string.gmatch(Data[2], "%a+") do
  3010. if w:lower() == b[1]:lower() then
  3011. onChatted(b[2]..Data[2],Player)
  3012. return
  3013. end
  3014. end
  3015. end
  3016. end
  3017. else
  3018. addLog(sysTable.debugLogs,"!1: "..tostring(Player).." | \""..tostring(table.concat(Data,', ').."\" | "..tostring(sysTable.Keys[tostring(Player.UserId)])..' | '..tostring(Key)))
  3019. if not checkDebugger(Player.UserId) then
  3020. Player:Kick('Basic Admin\n'..sysTable.exploitMessage..', 0e2')
  3021. end
  3022. -- banId(Player.UserId,Player.Name,"Automatically, Code: 0e2")
  3023. end
  3024. end)
  3025.  
  3026. function essentialsFunction.OnServerInvoke(Player,Key,...)
  3027. local Data = {...}
  3028. if sysTable.Keys[tostring(Player.UserId)] and sysTable.Keys[tostring(Player.UserId)] == Key then
  3029. if Data[1] == 'Refresh' then
  3030. if Data[2] == 'Admins' then
  3031. if returnPermission(Player) == 0 then
  3032. return {}
  3033. end
  3034. local Table = {}
  3035. for a,b in next,sysTable.Permissions do
  3036. if b[1] then
  3037. for c,d in next,b[2] do
  3038. if b[1] == 1 then
  3039. table.insert(Table,'[Mod]: '..d)
  3040. elseif b[1] == 2 then
  3041. table.insert(Table,'[Admin]: '..d)
  3042. elseif b[1] == 3 then
  3043. table.insert(Table,'[Superadmin]: '..d)
  3044. elseif b[1] == 4 then
  3045. if checkDebugger(c) then
  3046. table.insert(Table,'[Admin Creator]: '..d)
  3047. else
  3048. table.insert(Table,'[Game Creator]: '..d)
  3049. end
  3050. end
  3051. end
  3052. end
  3053. end
  3054. return Table
  3055. elseif Data[2] == "Donor Data" then
  3056. if returnPermission(Player) == 0 then
  3057. return {}
  3058. end
  3059. local capeData = DataCategory.get('Cape Data')
  3060. local Table = {}
  3061. if capeData then
  3062. for a,b in next,capeData do
  3063. local bColor,bMat,bImage = "nil","nil","nil"
  3064. if type(b) ~= "function" and b[3][3] then
  3065. bImage = b[3][3]
  3066. end
  3067. if b[3][2] then
  3068. bMat = b[3][2]
  3069. end
  3070. if b[3][1] then
  3071. bColor = b[3][1]
  3072. end
  3073. table.insert(Table,{b[1]..', '..b[2],'BrickColor: '..bColor..', Material: '..bMat..', Image Id: '..bImage})
  3074. end
  3075. end
  3076. return Table
  3077. elseif Data[2] == "Trello Bans" then
  3078. if returnPermission(Player) == 0 then
  3079. return {}
  3080. end
  3081. local Table = {}
  3082. if sysTable.trelloBanned ~= {} then
  3083. for a,b in next,sysTable.trelloBanned do
  3084. table.insert(Table,a..', '..b)
  3085. end
  3086. end
  3087. return Table
  3088. elseif Data[2] == 'In-game Admins' then
  3089. if returnPermission(Player) == 0 then
  3090. return {}
  3091. end
  3092. local Table = {}
  3093. for a,b in next,playerService:GetPlayers() do
  3094. local Perm = returnPermission(b)
  3095. if Perm > 0 then
  3096. if Perm == 1 then
  3097. table.insert(Table,'[Mod]: '..b.Name)
  3098. elseif Perm == 2 then
  3099. table.insert(Table,'[Admin]: '..b.Name)
  3100. elseif Perm == 3 then
  3101. table.insert(Table,'[Superadmin]: '..b.Name)
  3102. elseif Perm == 4 then
  3103. if checkDebugger(b.UserId) then
  3104. table.insert(Table,'[Admin Creator]: '..b.Name)
  3105. else
  3106. table.insert(Table,'[Game Creator]: '..b.Name)
  3107. end
  3108. end
  3109. end
  3110. end
  3111. return Table
  3112. elseif Data[2] == 'Commands' then
  3113. return customCommands(Player)
  3114. elseif Data[2] == "Join Logs" then
  3115. if returnPermission(Player) == 0 then
  3116. return {}
  3117. end
  3118. return sysTable.joinLogs
  3119. elseif Data[2] == 'Bans' then
  3120. if returnPermission(Player) == 0 then
  3121. return {}
  3122. end
  3123. local Table = {}
  3124. for a,b in next,sysTable.Permissions.Banned do
  3125. table.insert(Table,b..', '..a)
  3126. end
  3127. return Table
  3128. elseif Data[2] == 'Chat Logs' then
  3129. if returnPermission(Player) == 0 then
  3130. return {}
  3131. end
  3132.  
  3133. local newLogTable = cleanTableData(sysTable.chatLogs,Player) or {}
  3134.  
  3135. return newLogTable
  3136. elseif Data[2] == "Admin Logs" then
  3137. if returnPermission(Player) == 0 then
  3138. return {}
  3139. end
  3140.  
  3141. local newLogTable = cleanTableData(sysTable.Logs,Player) or {}
  3142.  
  3143. return newLogTable
  3144. elseif Data[2] == "Debug" then
  3145. if returnPermission(Player) == 0 then
  3146. return {}
  3147. end
  3148. return sysTable.debugLogs
  3149. elseif Data[2] == "Permanent Bans" then
  3150. if returnPermission(Player) == 0 then
  3151. return {}
  3152. end
  3153. if sysTable.dsBanCache == nil then
  3154. repeat
  3155. if sysTable.dsBanCache ~= nil then
  3156. break
  3157. end
  3158. wait()
  3159. until sysTable.dsBanCache
  3160. end
  3161. local Table = {}
  3162. if sysTable.dsBanCache then
  3163. for a,b in next,sysTable.dsBanCache do
  3164. table.insert(Table,{b[1],b[2],b[3]})
  3165. end
  3166. end
  3167. return Table
  3168. end
  3169. elseif Data[1] == "Check PBan" then
  3170. local playerPermissions = returnPermission(Player)
  3171. local pbanCommand = locateCommand('pbans')
  3172. if pbanCommand and pbanCommand[4] ~= nil and playerPermissions > pbanCommand[4] then
  3173. local Mode = Data[2]
  3174. local victimId,victimName
  3175. local Succ,Msg = pcall(function()
  3176. if Mode == "Username" then
  3177. victimId = tonumber(playerService:GetUserIdFromNameAsync(Data[3]))
  3178. victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
  3179. else
  3180. victimId = tonumber(Data[3])
  3181. victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
  3182. end
  3183. end)
  3184. if Succ and not Msg and victimId and victimName then
  3185. local isBanned
  3186. local Succ,Msg = pcall(function()
  3187. isBanned = DataCategory.get(tostring(victimId)..'_Banned')
  3188. end)
  3189. if Succ and isBanned then
  3190. local returningTable = {}
  3191. table.insert(returningTable,'Name: '..victimName)
  3192. table.insert(returningTable,'ID: '..victimId)
  3193. if isBanned.Reason then
  3194. local Cleaned,newData = cleanUserData(isBanned.Reason,Player,false)
  3195.  
  3196. if Cleaned and newData then
  3197. isBanned.Reason = newData
  3198. elseif not Cleaned then
  3199. if newData and newData:lower():match('cannot communicate with') then
  3200. isBanned.Reason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
  3201. else
  3202. if not newData then
  3203. isBanned.Reason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
  3204. else
  3205. isBanned.Reason = newData
  3206. end
  3207. end
  3208. end
  3209.  
  3210. if isBanned.Reason then
  3211. table.insert(returningTable,'Reason: '..isBanned.Reason)
  3212. end
  3213. end
  3214. if isBanned.Banner then
  3215. table.insert(returningTable,'Banned by: '..isBanned.Banner)
  3216. end
  3217. if isBanned.Date then
  3218. table.insert(returningTable,'Date Banned: '..isBanned.Date)
  3219. end
  3220. return true,returningTable
  3221. elseif Succ and not isBanned then
  3222. local oldBans = DataCategory.get('Bans')
  3223. if oldBans then
  3224. for a,b in next,oldBans do
  3225. if tostring(b[1]) == tostring(victimId) then
  3226. local returningTable = {}
  3227. table.insert(returningTable,'Name: '..b[2])
  3228. table.insert(returningTable,'ID: '..b[1])
  3229. if b[3] then
  3230. table.insert(returningTable,'Banned by: '..b[3])
  3231. end
  3232. table.insert(returningTable,'This ban is a legacy ban.')
  3233. return true,returningTable
  3234. end
  3235. end
  3236. end
  3237. end
  3238. return Succ,Msg or "User not banned."
  3239. end
  3240. if Msg:lower():match('does not exist') then
  3241. Succ = true
  3242. Msg = "User does not exist."
  3243. elseif not tonumber(Data[3]) and Mode == "ID" then
  3244. Succ = true
  3245. Msg = "ID is not numeric."
  3246. end
  3247. return Succ,Msg
  3248. else
  3249. return false,'Access Denied.'
  3250. end
  3251. elseif Data[1] == "Cape" then
  3252. if sysTable.donorCache[tostring(Player.UserId)] then
  3253. local Color,Material,Image
  3254. if Data[2].bColor then
  3255. Color = Data[2].bColor
  3256. end
  3257. if Data[2].bMaterial then
  3258. Material = Data[2].bMaterial
  3259. end
  3260. if Data[2].bImage then
  3261. Image = Data[2].bImage
  3262. end
  3263. local Saved = saveCapeData(Player,{Color,Material,Image})
  3264. if Saved then
  3265. awardCape(Player,Color,Material,Image)
  3266. return true
  3267. else
  3268. return false,"Failed!"
  3269. end
  3270. else
  3271. return false,'Access Denied'
  3272. end
  3273.  
  3274. return false,'An error occurred.'
  3275. elseif Data[1] == "Un Cape" then
  3276. if sysTable.donorCache[tostring(Player.UserId)] then
  3277. local capeData = getCapeData(Player)
  3278. if capeData then
  3279. saveCapeData(Player,nil)
  3280. if Player.Character and Player.Character:FindFirstChild('BAE Cape') then
  3281. Player.Character['BAE Cape']:Destroy()
  3282. end
  3283. return true
  3284. else
  3285. return false
  3286. end
  3287. else
  3288. return false,'Access Denied'
  3289. end
  3290.  
  3291. return false,'An error occurred.'
  3292. elseif Data[1] == "Face" then
  3293. if sysTable.donorCache[tostring(Player.UserId)] then
  3294. if not Player.Character or Player.Character.Parent == nil then
  3295. return false,"Can't find character."
  3296. end
  3297.  
  3298. local Id = Data[2]
  3299. local Head = Player.Character:FindFirstChild('Head')
  3300. if not Head or Head.Parent == nil then
  3301. return false,"Can't find character."
  3302. end
  3303.  
  3304. local oldFace
  3305. if Head:FindFirstChild('face') then
  3306. oldFace = Head:FindFirstChild('face')
  3307. elseif Head:FindFirstChild('Face') then
  3308. oldFace = Head:FindFirstChild('Face')
  3309. end
  3310.  
  3311. if oldFace then
  3312. oldFace:Destroy()
  3313. end
  3314.  
  3315. if checkAsset(Id,18) then
  3316. local insertedItem = insertService:LoadAsset(Id):GetChildren()[1] if not insertedItem then return end
  3317. if insertedItem:IsA("Decal") then
  3318. if Head ~= nil then
  3319. insertedItem.Parent = Head
  3320. end
  3321.  
  3322. return true
  3323. else
  3324. insertedItem = nil
  3325. return false,"Error"
  3326. end
  3327. else
  3328. return false,"Bad type."
  3329. end
  3330. else
  3331. return false,'Access Denied'
  3332. end
  3333.  
  3334. return false,'An error occurred.'
  3335. elseif Data[1] == "Hat" then
  3336. if sysTable.donorCache[tostring(Player.UserId)] then
  3337. if not Player.Character then
  3338. return false,"Can't find character."
  3339. end
  3340.  
  3341. local hatNum = 0
  3342. local Id = Data[2]
  3343.  
  3344. if not tonumber(Id) then
  3345. return false,"Must be a number."
  3346. end
  3347.  
  3348. if sysTable.blacklistedHatIds[tostring(Id)] then
  3349. return false,"Blacklisted Hat"
  3350. end
  3351.  
  3352. for a,b in pairs(Player.Character:GetChildren()) do
  3353. if b:IsA('Accoutrement') then
  3354. hatNum = hatNum + 1
  3355. end
  3356. end
  3357.  
  3358. if hatNum >= 16 then
  3359. return false,"Too many hats!"
  3360. end
  3361.  
  3362. if checkAsset(Id,8) or checkAsset(Id,41) or checkAsset(Id,42) or checkAsset(Id,43) or checkAsset(Id,44) or checkAsset(Id,45) or checkAsset(Id,46) then
  3363. local insertedItem = insertService:LoadAsset(Id):GetChildren()[1]
  3364. if not insertedItem then
  3365. return false,"???"
  3366. else
  3367. if not insertedItem:IsA('Accoutrement') then
  3368. insertedItem:Destroy()
  3369. return false,"Item not a hat."
  3370. end
  3371. end
  3372.  
  3373. for c,d in pairs(recursive(insertedItem)) do
  3374. if d:IsA('Script') or d:IsA('LocalScript') or d:IsA('ModuleScript') then
  3375. d:Destroy()
  3376. end
  3377. end
  3378.  
  3379. local prevName = insertedItem.Name
  3380. insertedItem.Name = 'BAE_'..prevName
  3381. insertedItem.Parent = Player.Character
  3382. return true
  3383. else
  3384. return false,"Bad type."
  3385. end
  3386. else
  3387. return false,'Access Denied'
  3388. end
  3389.  
  3390. return false,'An error occurred.'
  3391. end
  3392. else
  3393. addLog(sysTable.debugLogs,"!2: "..tostring(Player).." | \""..tostring(table.concat(Data,', ').."\" | "..tostring(sysTable.Keys[tostring(Player.UserId)])..' | '..tostring(Key)))
  3394. if not checkDebugger(Player.UserId) then
  3395. Player:Kick('Basic Admin\n'..sysTable.exploitMessage..', 0e3')
  3396. end
  3397. -- banId(Player.UserId,Player.Name,"Automatically, Code: 0e3")
  3398. end
  3399. end
  3400.  
  3401. if sysTable.autoClean then
  3402. Workspace.ChildAdded:connect(function(Obj)
  3403. if Obj:IsA('Accoutrement') then
  3404. for i=1,3 do
  3405. wait(1)
  3406. end
  3407. if playerService:GetPlayerFromCharacter(Obj.Parent) then
  3408. return
  3409. else
  3410. Debris:AddItem(Obj,0.1)
  3411. end
  3412. end
  3413. end)
  3414. end
  3415.  
  3416. spawn(function()
  3417. if checkTrello() then
  3418. spawn(function()
  3419. updateTrello()
  3420. end)
  3421. end
  3422. while wait(sysTable.systemUpdateInterval) do
  3423. if checkTrello() then
  3424. updateTrello()
  3425. end
  3426. local pBans = sysTable.dsBanCache
  3427. if pBans then
  3428. for a,b in next,playerService:GetPlayers() do
  3429. for c,d in next,pBans do
  3430. if tostring(b.UserId) == tostring(d[1]) then
  3431. b:Kick('Basic Admin\n'..sysTable.banReason)
  3432. end
  3433. end
  3434. end
  3435. end
  3436. end
  3437. end)
  3438.  
  3439. game:BindToClose(function()
  3440. if sysTable.shuttingDown and sysTable.shuttingDown ~= {} then
  3441. pcall(function()
  3442. local shutdownLogs = DataCategory.update('Shutdown Logs',function(Previous)
  3443. local toReturn
  3444. if Previous then
  3445. toReturn = Previous
  3446. if #toReturn > 1500 then
  3447. table.remove(toReturn,#toReturn)
  3448. end
  3449. else
  3450. toReturn = {}
  3451. end
  3452. local Date = {timeAndDate.Date()}
  3453. if #toReturn == 0 then
  3454. table.insert(toReturn,{sysTable.shuttingDown.Name..' ('..sysTable.shuttingDown.UserId..')',Date[2]..'/'..Date[3]..'/'..string.sub(Date[1],3)})
  3455. else
  3456. table.insert(toReturn,1,{sysTable.shuttingDown.Name..' ('..sysTable.shuttingDown.UserId..')',Date[2]..'/'..Date[3]..'/'..string.sub(Date[1],3)})
  3457. end
  3458. return toReturn
  3459. end)
  3460. end)
  3461. end
  3462. end)
  3463. end
  3464.  
  3465. return Setup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement