DevKxnq1221

Untitled

Sep 2nd, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. local DataStore = game:GetService("DataStoreService")
  2. local DSName = DataStore:GetDataStore("Bamboo")
  3.  
  4. game.Players.PlayerAdded:Connect(function(Player)
  5. local Data = Player:WaitForChild("Data")
  6. local Banned = Data:WaitForChild("Banned")
  7. Banned.Value = DSName:GetAsync(Player.UserId)
  8. DSName:SetAsync(Player.UserId, Banned.Value)
  9. print("Data found")
  10. end)
  11.  
  12. game.Players.PlayerRemoving:Connect(function(Player)
  13. DSName:SetAsync(Player.UserId, Player.Data.Banned.Value)
  14. end)
  15.  
  16. game.Players.PlayerAdded:Connect(function(Player)
  17.  
  18. local Data = Player:WaitForChild("Data")
  19. local Banned = Data:WaitForChild("Banned")
  20.  
  21. if Player.Data.BannedTime.Value <= 5 then
  22. print("Time less than 5")
  23. Player.Data.BannedTime.Value = os.time()
  24. elseif Player.Data.BannedTime.Value >= 5 then
  25. print("Time greater than 5")
  26. if os.time() >= Player.Data.BannedTime.Value + 86400 then
  27. print("Time hasnt been served")
  28. Player.Data.BannedTime.Value = 0
  29. Player.Data.Banned.Value = false
  30. else
  31. print("Kicked")
  32. Player:Kick("You have been Banned for logging.")
  33. end
  34. end
  35. if Banned.Value == true then
  36. print("Value true")
  37. Player:Kick("You have been banned for a day.")
  38. else
  39. print("You not banned")
  40. Banned.Value = false
  41. end
  42. end)
  43.  
  44. game.Players.PlayerRemoving:Connect(function(Player)
  45. Player.CharacterAdded:Connect(function(Character)
  46. local inCombat = Player:WaitForChild("InCombat")
  47. if inCombat.Value == true then
  48. print("Player in combat")
  49. if Player.Data.BannedTime.Value <= 5 then
  50. print("Time is less than and equal to 5")
  51. Player.Data.BannedTime.Value = 500
  52. elseif Player.Data.BannedTime.Value >= 5 then
  53. print("Player time is greater than 5 again")
  54. if os.time() >= Player.Data.BannedTime.Value + 86400 then
  55. print("Time not server")
  56. Player.Data.BannedTime.Value = 0
  57. Player.Data.Banned.Value = false
  58. else
  59. Player:Kick("You have been Banned for logging.")
  60. end
  61. end
  62. end
  63. end)
  64. end)
Advertisement
Add Comment
Please, Sign In to add comment