Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---Dingdong272
- ---To use: Say "kick/playername"
- ---no capitals needed!
- 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
- local m = Instance.new("Message")
- m.Parent = KickedPlayer
- m.Text = "You have been kicked" --gives a message saying you were kicked
- wait(2)
- m.Parent = nil --removes the message
- KickedPlayer.Parent = nil --removes the player
- p.Parent = nil --huh?
- end
- function onChatted(msg, recipient, speaker)
- --convert to all lowercase (you don't need any capitals)
- local source = string.lower(speaker.Name)
- msg = string.lower(msg)
- if string.match(msg, "kick/") then --someone has said "kick/playername"
- playerz = game.Players:GetChildren()
- for i=1, #playerz do
- if string.match(msg, string.lower(playerz[i].Name)) then
- KickPlayer(playerz[i].Name, speaker)
- end
- end
- end
- end
- function onPlayerEntered(newPlayer)
- newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
- end
- game.Players.ChildAdded:connect(onPlayerEntered)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement