Advertisement
Ninjalol

ol

Mar 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. local Admin = "NinjaRoyalAngel" -- Defining who the admin is using a variable.
  2.  
  3. local Players = Game:GetService("Players") -- Defining Players Service using a variable.
  4.  
  5. Players.PlayerAdded:connect(function(Player) -- Event and function when a player has joined.
  6. if Player.Name == Admin then -- Checking if the player is the admin.
  7. Player.Chatted:connect(function(Message) -- Event and function when the admin chats.
  8. if Message ~= nil then --Checking if the message is not nil with the if statement. (The message is nil when teamchat is used.
  9. if string.lower(string.sub(Message, 1, 4)) == "kick" then --Checking if the kick command is used. string.sub is used to get several characters of the string, in this case the first four. string.lower is used to convert the string to a lowercase string. Saying KICK or Kick instead of kick would work as well.
  10. local Target = Players:FindFirstChild(string.sub(Message, 6)) -- Defining the target using a variable. string.sub is this time used to get all of the characters behind "kick ".
  11. if Target ~= nil then -- Checking if the target is found using an if statement.
  12. Target:Kick() --Removing the target from the game using the :Kick() method on the player object.
  13. end -- Closing the if statement at line eleven.
  14. end -- Closing the if statement at line nine.
  15. end -- Closing the if statement at line eight.
  16. end) -- Closing function and event at line seven.
  17. end -- Closing the if statement at line six.
  18. end) -- Closing function and event at line five.
  19.  
  20. --If you have any more suggestions or question, leave a reaction on my video and I will answer it as soon as possible.
  21. --You can also PM me on ROBLOX. (koen500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement