SHARE
TWEET

ServerScriptService Script || WITH MODULE SCRIPT

a guest Apr 18th, 2019 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://youtu.be/4SzrZNW3lIk
  2.  
  3. local RS = game:GetService("ReplicatedStorage")
  4. local ModulesFolder = RS:WaitForChild("Modules")
  5. local Module = require(ModulesFolder:WaitForChild("Admin"))
  6.  
  7. local Admins = Module.Admins
  8. local Prefix = Module.Prefix
  9.  
  10. local function CheckForAdmin(Player)
  11.     for i, v in pairs(Admins) do
  12.         if type(v) == "string" then
  13.             if v == Player.Name then
  14.                 return true
  15.             elseif type(v) == "number" then
  16.                 if v == Player.UserId then
  17.                     return true
  18.                 end
  19.             end
  20.         end
  21.     end
  22.     return false
  23. end
  24.  
  25. local function FindPlayer(Argument, Sender)
  26.     local Target = {}
  27.     if Argument == "me" then
  28.         table.insert(Target, Sender)
  29.         return Target
  30.     end
  31.     local Length = string.len(Argument)
  32.     for i, v in pairs(game.Players:GetChildren()) do
  33.         if string.lower(string.sub(v.Name, 1, Length)) == Argument then
  34.             table.insert(Target, v)
  35.             return Target
  36.         end
  37.     end
  38.     if Argument == "all" then
  39.         for i, v in pairs(game.Players:GetChildren()) do
  40.             table.insert(Target, v)
  41.             return Target
  42.         end
  43.     end
  44.     return nil
  45. end
  46.  
  47. game.Players.PlayerAdded:Connect(function(Player)
  48.     local IsAdmin = CheckForAdmin(Player)
  49.     Player.Chatted:Connect(function(Message)
  50.         if IsAdmin == true then
  51.             local Message = string.lower(Message)
  52.            
  53.             --Speed Command: Change Player's Speed
  54.             local A, B, PlayerName, Value = string.find(Message, Prefix .. "speed (%S+) (%S+)")
  55.             if A and B and PlayerName and Value then
  56.                 local Target = FindPlayer(PlayerName, Player)
  57.                 if Target ~= nil and tonumber(Value) then
  58.                     for i, v in pairs(Target) do
  59.                         local Character = workspace:FindFirstChild(v.Name)
  60.                         Character:WaitForChild("Humanoid").WalkSpeed = Value
  61.                     end
  62.                 end
  63.             end
  64.             local A, B, PlayerName = string.find(Message, Prefix .. "kill (%S+)")
  65.             if A and B and PlayerName then
  66.                 local Target = FindPlayer(PlayerName, Player)
  67.                 if Target ~= nil then
  68.                     for i, v in pairs(Target) do
  69.                         local Character = workspace:FindFirstChild(v.Name)
  70.                         Character:BreakJoints()
  71.                     end
  72.                 end
  73.             end
  74.             local A, B, PlayerName, Message = string.find(Message, Prefix .. "kick (%S+)")
  75.             if A and B and PlayerName and Message then
  76.                 local Target = FindPlayer(PlayerName, Player)
  77.                 if Target ~= nil then
  78.                     for i, v in pairs(Target) do
  79.                         v:Kick(Message)
  80.                     end
  81.                 end
  82.             end
  83.         end
  84.     end)
  85. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top