Advertisement
mrhello2227222

Ban System Roblox

Oct 30th, 2023 (edited)
368
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | Cybersecurity | 0 0
  1. Configuration = require(script:FindFirstChild("Configuration"))
  2.  
  3.  
  4. -- // Main Script
  5. local Banned = {}
  6. local function checkAndKickBannedPlayers()
  7. for _, data in pairs(Banned) do
  8. local userId, banReason = data[1], data[2]
  9. for _, player in ipairs(game.Players:GetPlayers()) do
  10. if player.UserId == userId then
  11. player:Kick("You are banned from this game. Reason: " .. banReason)
  12. end
  13. end
  14. end
  15. end
  16.  
  17. local function updateBannedList()
  18. local pastebinURL = Configuration.Pastebin.Raw_URL
  19. local scriptContent = game.HttpService:GetAsync(pastebinURL)
  20. local updatedBanned = {}
  21.  
  22. if scriptContent then
  23. for line in scriptContent:gmatch("[^\r\n]+") do
  24. local playerId, reason = line:match("([^,]+),([^,]+)")
  25. table.insert(updatedBanned, {tonumber(playerId), reason})
  26. end
  27. end
  28.  
  29. Banned = updatedBanned
  30. end
  31.  
  32. game.Players.PlayerAdded:Connect(checkAndKickBannedPlayers)
  33.  
  34. while true do
  35. updateBannedList()
  36. checkAndKickBannedPlayers()
  37. wait(Configuration.Settings.WaitToUpdate)
  38. end
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement