Advertisement
nicopow

Untitled

Jun 21st, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. local VoteCountToFix = 0
  2. local FixGame = false
  3.  
  4. local Players = {}
  5.  
  6. local chat = game:GetService("Chat")
  7.  
  8. for i,v in next, script:GetChildren() do
  9. v:Clone().Parent = chat
  10. end
  11.  
  12. function SendData(Amount)
  13. if(VoteCountToFix == 5) then
  14. VoteCountToFix = 0
  15. else
  16. VoteCountToFix = VoteCountToFix + Amount
  17. end
  18. end
  19.  
  20. for i,v in next, game:GetService("Players"):GetPlayers() do
  21. Players[v.Name] = {hasVoted = false}
  22. v.Chatted:connect(function(Msg)
  23. if(Msg:lower()=="votefix/") then
  24. if(Players[v.Name].hasVoted == true) then
  25. warn("You have already voted!")
  26. else
  27. Players[v.Name].hasVoted = true
  28. SendData(1)
  29. end
  30. end
  31. end)
  32. end
  33.  
  34. game:GetService("Players").PlayerAdded:connect(function(v)
  35. Players[v.Name] = {hasVoted = false}
  36. v.Chatted:connect(function(Msg)
  37. if(Msg:lower()=="votefix/") then
  38. if(Players[v.Name].hasVoted == true) then
  39. warn("You have already voted!")
  40. else
  41. Players[v.Name].hasVoted = true
  42. SendData(1)
  43. end
  44. end
  45. end)
  46. end)
  47.  
  48. spawn(function()
  49. while wait(1) do
  50. print(VoteCountToFix)
  51. end
  52. end)
  53.  
  54. spawn(function()
  55. while wait(1) do
  56. return Players
  57. end
  58. end)
  59.  
  60. function MakeLoop()
  61. while true do wait()
  62. if(VoteCountToFix == 5) then
  63. FixGame = true
  64. warn("Fixing game!")
  65. break
  66. else
  67. if(FixGame == false) then
  68. VoteCountToFix = 0
  69. break
  70. end
  71. end
  72. end
  73. end
  74.  
  75. MakeLoop()
  76.  
  77. delay(0,function()
  78. while true do wait()
  79. if(FixGame == true) then
  80. pcall(function()
  81. workspace.BuildingPlates:remove()
  82. workspace["Smooth Block Model"]:remove()
  83. workspace.SpawnPoints:remove()
  84. workspace.Grass:remove()
  85. FixGame = false
  86. chat.BuildingPlates:Clone().Parent = workspace
  87. chat.SpawnPoints:Clone().Parent = workspace
  88. chat.Grass:Clone().Parent = workspace
  89. chat["Smooth Block Model"]:Clone().Parent = workspace
  90. for a,s in next, game:GetService("Players"):GetPlayers() do
  91. s:LoadCharacter()
  92. end
  93. for q,w in next, Players do
  94. w.hasVoted = false
  95. end
  96. end)
  97. warn("Game fixed!")
  98. MakeLoop()
  99. break
  100. end
  101. end
  102. end)
  103.  
  104. return nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement