Advertisement
Ezezezezezgamer

Unban Script by CPKQ

Apr 2nd, 2024
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1.  
  2. local player = game.Players.LocalPlayer
  3. local Unbansage = 'Succesfully'
  4. local DataStoreService = game:GetService("DataStoreService")
  5. local BansDataStore = DataStoreService:GetDataStore("BansDataStore")
  6. local userId = player.UserId
  7.  
  8. -- Function to unban a user
  9. local function unban(userId)
  10. local success, errorMessage = pcall(function()
  11. -- Attempt to get the current list of banned users
  12. local bannedUsers = BansDataStore:GetAsync("BannedUsers") or {}
  13.  
  14. -- Check if the user is currently banned
  15. if bannedUsers[userId] then
  16. -- User is found in the ban list, remove them
  17. bannedUsers[userId] = nil
  18.  
  19. -- Update the DataStore with the modified list
  20. BansDataStore:SetAsync("BannedUsers", bannedUsers)
  21.  
  22. print("Succesfully unbanned " .. player.Name .. " - Made by cpkq")
  23. else
  24. -- User was not found in the ban list
  25. print("The user " .. player.Name .. " was not found - Made by cpkq")
  26. end
  27. end)
  28.  
  29. if not success then
  30. warn('Failed to unban' .. player.Name .. ' - Made by cpkq')
  31. end
  32. end
  33.  
  34. unban(userId)
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement