Advertisement
DaDogeDevelopment

:kick script

Jun 13th, 2023 (edited)
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. local Admins = { -- List of admin usernames
  2. "ThatDogeDevelopment",
  3. "Admin2",
  4. -- Add more admin usernames here
  5. }
  6.  
  7. game.Players.PlayerAdded:Connect(function(player)
  8. player.Chatted:Connect(function(message)
  9. local args = string.split(message, " ")
  10. local isAdmin = false
  11.  
  12. for _, admin in ipairs(Admins) do
  13. if player.Name == admin then
  14. isAdmin = true
  15. break
  16. end
  17. end
  18.  
  19. if isAdmin and #args >= 3 and args[1] == ":kick" then
  20. local targetPlayer = game.Players:FindFirstChild(args[2])
  21. local reason = table.concat(args, " ", 3)
  22.  
  23. if targetPlayer then
  24. targetPlayer:Kick(reason)
  25. game.Players.PlayerAdded:Connect(function(newPlayer)
  26. if newPlayer.Name == args[2] then
  27. newPlayer:Kick("You were previously kicked from this server.")
  28. end
  29. end)
  30. else
  31. print("Player not found!")
  32. end
  33. end
  34. end)
  35. end)
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement