Advertisement
Mitko1223tm

another advanced test

Jan 30th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. --//Admin Commands Script
  2. --//Variables\\--
  3. local DataStore = game:GetService("DataStoreService")
  4. local BanList = DataStore:GetDataStore("BanList")
  5. local Admins = {"Mitko1223tm", "Kolsmen"} --//People who you want as admins
  6.  
  7. --//Events\\--
  8. game.Players.PlayerAdded:connect(function(Player)
  9. local Folder = Instance.new("Folder", Player)
  10. Folder.Name = "PlayerValues"
  11.  
  12. local BanCheck = Instance.new("BoolValue", Folder)
  13. BanCheck.Name = "IsBanned"
  14. BanCheck.Value = BanList:GetAsync(Player.userId) or false --//False is default if no save for the player
  15.  
  16. --//Checks if the player is banned or not
  17. if Player.PlayerValues.IsBanned.Value == true then
  18. Player:Kick("You're Banned") --//Reason for kick
  19. end
  20.  
  21. Player.Chatted:connect(function(message)
  22. for i, AdminName in ipairs(Admins) do
  23. if Player.Name == AdminName then
  24. --//Commands\\--
  25. --//Kill Command
  26. if message:sub(1, 6) == "/kill " then
  27. local TargetPlayer = game.Players:FindFirstChild(message:sub(7))
  28. if TargetPlayer then
  29. local Character = TargetPlayer.Character
  30. if Character then
  31. Character.Humanoid.Health = 0
  32. end
  33. end
  34. end
  35.  
  36. --//Heal Command
  37. if message:sub(1, 6) == "/heal " then
  38. local TargetPlayer = game.Players:FindFirstChild(message:sub(7))
  39. if TargetPlayer then
  40. local Character = TargetPlayer.Character
  41. if Character then
  42. Character.Humanoid.Health = Character.Humanoid.MaxHealth
  43. end
  44. end
  45. end
  46.  
  47. --//Kick Command
  48. if message:sub(1, 6) == "/kick " then
  49. local TargetPlayer = game.Players:FindFirstChild(message:sub(7))
  50. if TargetPlayer then
  51. TargetPlayer:Kick("Kicked by " .. Player.Name) --//Kick message/reason
  52. end
  53. end
  54.  
  55. --//Ban Command
  56. if message:sub(1, 5) == "/ban " then
  57. local TargetPlayer = game.Players:FindFirstChild(message:sub(6))
  58. if TargetPlayer then
  59. local BanCheck = TargetPlayer.PlayerValues.IsBanned
  60. if BanCheck then
  61. BanCheck.Value = true
  62. BanList:SetAsync(TargetPlayer.userId, true)
  63. end
  64. TargetPlayer:Kick("You've been banned by " .. Player.Name) --//Reason || Message
  65. end
  66. end
  67.  
  68. --//Unban Command
  69. if message:sub(1, 7) == "/unban " then --//USES ID NOT NAME
  70. local UserId = tonumber(message:sub(8))
  71. if UserId then
  72. BanList:SetAsync(UserId, false)
  73. end
  74. end
  75. break
  76. end
  77. end
  78. end)
  79. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement