Advertisement
V3rmLua33

Ban list

Feb 9th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local DataStoreService = Game:GetService("DataStoreService")
  2. local persistentBannedList = DataStoreService:GetDataStore("PersistentBannedList")
  3.  
  4. -- this syntax is an alternate way to write
  5. -- data within tables, it still works though
  6. local minimumBannedList = {
  7.     ["Tinfold"] = true;
  8.     ["chucky4523"] = true;
  9.     ["x1op"] = true;
  10. }
  11.  
  12. function isPlayerBanned(player)
  13.     return minimumBannedList[player.Name]
  14.         or persistentBannedList:GetAsync(player.Name)
  15. end
  16. function setBanStatus(player, status)
  17.     minimumBannedList[player.Name] = status
  18.     persistentBannedList:SetAsync(player.Name, status)
  19. end
  20. script.SetBanStatus.OnInvoke = setBanStatus
  21.  
  22. function onPlayerAdded(player)
  23.     if isPlayerBanned(player) then
  24.         player:Kick()
  25.     end
  26. end
  27. Game:GetService("Players").PlayerAdded:connect(onPlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement