Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Admin = "Guest537561"
- local Players = Game:GetService("Players") -- Defining Players Service using a variable.
- Players.PlayerAdded:connect(function(Player) -- Event and function when a player has joined.
- if Player.Name == Admin then -- Checking if the player is the admin.
- Player.Chatted:connect(function(Message) -- Event and function when the admin chats.
- if Message ~= nil then --Checking if the message is not nil with the if statement. (The message is nil when teamchat is used.
- 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.
- 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 ".
- if Target ~= nil then -- Checking if the target is found using an if statement.
- Target:Kick() --Removing the target from the game using the :Kick() method on the player object.
- end -- Closing the if statement at line eleven.
- end -- Closing the if statement at line nine.
- end -- Closing the if statement at line eight.
- end) -- Closing function and event at line seven.
- end -- Closing the if statement at line six.
- end) -- Closing function and event at line five.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement