Nov 27th, 2014
Harus Di Baca!Dukung Saya: SOCIAL MEDIA ♛Fa.
Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
- local admin = 'itsJaden2' --Who is the one who has the admin.
- local Players = Game:GetService('Players') Definding service using a varaiable.
- 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
- if Message ~= nil then --Checking if the message is not nil with the if statement. (The Message is in 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 serval characters of the string, this cause 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)) -- Defending the target using a varbile. stirng.sub is the time used to get all of the characters behind 'kick '.
- if Target ~= nil then Checking if the target is found using a if statement.
- Target:Kick() --Removing the target from the game using the: Kick() method on the player object.
- end -- Closing the statement if event at line twevle
- end) --Closing the statement if event at line nine.
- end) --Closing the statement if event at line eight.
- end) -- Closing the if statement at line six.
RAW Paste Data
Jul 19th, 2019
Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
- ---To use: Say 'kick/playername'
- function KickPlayer(name, source)
- p = game.Workspace:findFirstChild(name) --find the person who you said to kick
- if p nil then return end --If the player is not there, then don't do anything
- if name source then return end --sorry, you can't kick yourself. (too bad!)
- local KickedPlayer = game.Players:findFirstChild(name) --finds the player to kick
- m.Parent = KickedPlayer
- m.Text = 'You have been kicked' --gives a message saying you were kicked
- m.Parent = nil --removes the message
- p.Parent = nil --huh?
- function onChatted(msg, recipient, speaker)
- --convert to all lowercase (you don't need any capitals)
- local source = string.lower(speaker.Name)
- if string.match(msg, 'kick/') then --someone has said 'kick/playername'
- for i=1, #playerz do
- if string.match(msg, string.lower(playerz[i].Name)) then
- end
- end
- newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
RAW Paste Data