Advertisement
Guest User

admin panel Script

a guest
Sep 17th, 2023
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. -- Define the command prefix for admin commands
  2. local commandPrefix = "!"
  3.  
  4. -- Function to handle player chat
  5. local function onPlayerChat(player, message)
  6. -- Check if the player is an admin (you can define your own admin check logic)
  7. local isAdmin = player:IsInGroup(YOUR_ADMIN_GROUP_ID) -- Replace with your group ID or custom admin check
  8.  
  9. -- Check if the message starts with the command prefix and the player is an admin
  10. if isAdmin and string.sub(message, 1, #commandPrefix) == commandPrefix then
  11. -- Get the command without the prefix
  12. local command = string.sub(message, #commandPrefix + 1)
  13.  
  14. -- Process admin commands
  15. if command == "kick" then
  16. -- Implement your kick logic here
  17. -- Example: game.Players:FindFirstChild(targetPlayerName):Kick("You have been kicked by an admin.")
  18. elseif command == "ban" then
  19. -- Implement your ban logic here
  20. -- Example: game.Players:FindFirstChild(targetPlayerName):Kick("You have been banned by an admin.")
  21. -- Add more admin commands as needed
  22. end
  23. end
  24. end
  25.  
  26. -- Connect the onPlayerChat function to the PlayerChatted event
  27. game.Players.PlayerAdded:Connect(function(player)
  28. player.Chatted:Connect(function(message)
  29. onPlayerChat(player, message)
  30. end)
  31. end)
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement