Advertisement
RedRobloxian

BanScript

Mar 11th, 2022
1,893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. --SERVERSCRIPTSERVICE SCRIPT BY BLUEBLOX
  2.  
  3. local banDS = game:GetService("DataStoreService"):GetDataStore("Bans")
  4. local mods = {613274783}
  5.  
  6. game:GetService("Players").PlayerAdded:Connect(function(plr)
  7.     local key = "-Banned" .. plr.UserId
  8.     local success, val = pcall(function()
  9.         return banDS:GetAsync(key)
  10.     end)
  11.     if(success) then
  12.         if(val) then
  13.             if(val[2] == true) then
  14.                 plr:Kick("\n You are permenetly banned. \n Reason: \n" .. val[1])
  15.             end
  16.         end
  17.     else
  18.         print("error" .. plr.UserId .. " " .. plr.Name)
  19.         warn(val)
  20.     end
  21. end)
  22.  
  23. game:GetService("ReplicatedStorage").BanRequest.OnServerEvent:Connect(function(mod, plr, reason)
  24.     if(table.find(mods, mod.UserId)) then
  25.         local key = "-Banned" .. plr.UserId
  26.         local success, err = pcall(function()
  27.             banDS:SetAsync(key, {reason, true})
  28.         end)
  29.         plr:Kick("\n You are permenently banned. \n Reason: \n" .. reason)
  30.     end
  31. end)
  32.  
  33. game:GetService("ReplicatedStorage").UnbanRequest.OnServerEvent:Connect(function(mod, plr, reason)
  34.     if(table.find(mods, mod.UserId)) then
  35.         local key = "-Banned" .. plr.UserId
  36.         local success, err =pcall(function()
  37.             banDS:SetAsync(key, {reason, false})
  38.         end)
  39.     end
  40. end)
  41.  
  42. game:GetService("ReplicatedStorage").KickRequest.OnServerEvent:Connect(function(mod, plr, reason)
  43.     if(table.find(mods, mod.UserId)) then
  44.         plr:Kick("/n You are kicked from this server. /n Reason: /n " .. reason)
  45.     end
  46. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement