DreamGamer_real

ROBLOX Kick player Script

Jul 19th, 2019
72,692
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---DreamGamer_real---
  2.  
  3.  
  4. ---To use: Say "kick/playername"
  5.  
  6.  
  7. ---no capitals needed!
  8.  
  9.  
  10. function KickPlayer(name, source)
  11. p = game.Workspace:findFirstChild(name) --find the person who you said to kick
  12. if p == nil then return end --If the player is not there, then don't do anything
  13. if name == source then return end --sorry, you can't kick yourself. (too bad!)
  14. local KickedPlayer = game.Players:findFirstChild(name) --finds the player to kick
  15. local m = Instance.new("Message")
  16. m.Parent = KickedPlayer
  17. m.Text = "You have been kicked" --gives a message saying you were kicked
  18. wait(2)
  19. m.Parent = nil --removes the message
  20. KickedPlayer.Parent = nil --removes the player
  21. p.Parent = nil --huh?
  22. end
  23.  
  24.  
  25. function onChatted(msg, recipient, speaker)
  26.  
  27. --convert to all lowercase (you don't need any capitals)
  28.  
  29. local source = string.lower(speaker.Name)
  30. msg = string.lower(msg)
  31.  
  32.  
  33.  
  34. if string.match(msg, "kick/") then --someone has said "kick/playername"
  35. playerz = game.Players:GetChildren()
  36. for i=1, #playerz do
  37. if string.match(msg, string.lower(playerz[i].Name)) then
  38. KickPlayer(playerz[i].Name, speaker)
  39. end
  40. end
  41. end
  42. end
  43.  
  44. function onPlayerEntered(newPlayer)
  45. newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  46. end
  47.  
  48. game.Players.ChildAdded:connect(onPlayerEntered)
RAW Paste Data