Advertisement
DarkusBlox

Roblox Studio - Ban Panel (Server Script)

Jul 24th, 2024
856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | Source Code | 0 0
  1. -- YT: @darkusblox for a FULL tutorial on how to use the ban panel!!
  2.  
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local banFunc = ReplicatedStorage:FindFirstChild("Ban")
  5. local unbanFunc = ReplicatedStorage:FindFirstChild("Unban")
  6.  
  7. local Players = game:GetService("Players")
  8.  
  9. local Admins = {70877449} -- IDs of users with access to the panel
  10.  
  11. local BanPanel = ReplicatedStorage:FindFirstChild("PanelGui")
  12.  
  13.  
  14. -- Do not edit unless you know what your're doing
  15.  
  16. game.Players.PlayerAdded:Connect(function(player)
  17.     if table.find(Admins, player.UserId) then
  18.         BanPanel:Clone().Parent = player.PlayerGui
  19.     end
  20. end)
  21.  
  22. banFunc.OnServerInvoke = function(player, ID, duration, Message, PrivReason, banAlts, UniverseBan)
  23.     if table.find(Admins, player.UserId) then
  24.        
  25.         local Config = {
  26.             UserIds = {ID},
  27.             ApplyToUniverse = UniverseBan,
  28.             Duration = duration,
  29.             DisplayReason = Message,
  30.             PrivateReason = PrivReason,
  31.             ExcludeAltAccounts = banAlts
  32.         }
  33.        
  34.         local succ, err = pcall(function()
  35.             Players:BanAsync(Config)
  36.         end)
  37.         if succ then
  38.             return true
  39.         else
  40.             print(err)
  41.             return false
  42.         end
  43.     end
  44. end
  45.  
  46. unbanFunc.OnServerInvoke = function(player, ID, UniverseUnban)
  47.     if table.find(Admins, player.UserId) then
  48.        
  49.         local Config = {
  50.             UserIds = {ID},
  51.             ApplyToUniverse = UniverseUnban
  52.         }
  53.         local succ, err = pcall(function()
  54.             Players:UnbanAsync(Config)
  55.         end)
  56.         if succ then
  57.             return true
  58.         else
  59.             print(err)
  60.             return false
  61.         end
  62.     end
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement