Advertisement
Guest User

fucking

a guest
May 27th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. data = script.Data --establish data folder variable for neat access ;)
  2. cps = {workspace.CP1,workspace.CP2,workspace.CP3}
  3. math.randomseed(tick())
  4. --thanks nstrike for the trello api
  5. function isTge(player)
  6. if player:IsInGroup(1180892) then
  7. return true
  8. else
  9. return false
  10. end
  11. end
  12. function wait10mins()
  13. local fucked = false
  14. for i=1,600 do
  15. if data.PointStats.A.Value ~= BrickColor.new('Bright green') and data.PointStats.B.Value ~= BrickColor.new('Bright green') and data.PointStats.C.Value ~= BrickColor.new('Bright green') then
  16. wait(1)
  17. else
  18. fucked = true
  19. return false
  20. end break
  21. end
  22. if fucked == false then
  23. return true
  24. end
  25. end
  26. function capturePoint(point,touchpoint,player,pointletter,tpvar,tobeowner)
  27. print('in')
  28. local pvar = true
  29. if data.RaidOn.Value == true then
  30. point.CaptureGUI.Enabled = true
  31. local i = 0
  32. point.CaptureGUI.Frame.ProgressUnder.Size = UDim2.new(0,0,0,10)
  33. repeat wait()
  34. if tpvar == true then
  35. i = i + 1
  36. point.CaptureGUI.Frame.ProgressOver.Text = tostring(i)..'%'
  37. end
  38. until i == 100 or pvar == false or point.CaptureGUI.Frame.ProgressUnder.Size == UDim2.new(1,0,0,10) or tpvar == false
  39. print('IM DONE')
  40. print(tostring(pvar))
  41. print(tostring(tpvar))
  42. data.PointStats[pointletter].Value = tobeowner
  43. point.CaptureGUI:Destroy()
  44. local clone = point.CaptureGUICLONE:Clone()
  45. clone.Name = 'CaptureGUI'
  46. clone.Parent = point
  47. return true
  48. end
  49. end
  50. function countChildren(obj) --counts how many children an object has - because im lazy to do it every time
  51. if obj:GetChildren() ~= nil then
  52. local childcount = 0
  53. for i,v in pairs(obj:GetChildren()) do
  54. childcount = childcount + 1
  55. end
  56. return childcount
  57. end
  58. end
  59. function countPlayers(team)
  60. local count = 0
  61. for i,v in pairs(game.Players:GetChildren()) do
  62. if v.TeamColor == team then
  63. count = count + 1
  64. end
  65. end
  66. return count
  67. end
  68. function spawnR2(spawnmodel,r2model)
  69. if spawnmodel ~= nil then
  70. if spawnmodel.Parent ~= nil then
  71. local randomnum = math.random(1,countChildren(spawnmodel))
  72. if spawnmodel:FindFirstChild(tostring(randomnum)) ~= nil then
  73. if r2model ~= nil then
  74. print('lottery number: spawn no. '..randomnum)
  75. local clone = r2model:Clone()
  76. clone.Name = "R2CLONE"
  77. clone.Parent = workspace
  78. clone:MoveTo(spawnmodel[tostring(randomnum)].Position - Vector3.new(0,1,0))
  79. clone.TouchedUser.Changed:connect(function()
  80. if wait10mins() == false then
  81. print('TGE Victory')
  82. elseif wait10mins() then
  83. print('RAIDER Victory')
  84. end
  85. end)
  86. else
  87. spawnR2(spawnmodel)
  88. end
  89. end
  90. end
  91. end
  92. end
  93. function clearUpTheShit()
  94. if workspace:FindFirstChild('R2CLONE') ~= nil then
  95. workspace['R2CLONE']:Destroy()
  96. for i,v in pairs(cps) do
  97. for e,g in pairs(v:GetChildren()) do
  98. if string.find(g.ClassName,'Value') ~= nil then
  99. g.Value = 0
  100. if string.lower(g.Name) == string.lower('maxcaptime') then
  101. g.Value = data.CapTimePoints.Value
  102. end
  103. end
  104. end
  105. end
  106. end
  107. end
  108.  
  109.  
  110. function startRaid() --WHERE IT ALL STARTS BABY
  111. clearUpTheShit()
  112. spawnR2(game.Lighting.R2Spawns,game.Lighting.R2Model)
  113. end
  114. data.RaidOn.Changed:connect(function()
  115. if data.RaidOn.Value == true and data.RaidDebounce.Value ~= true then
  116. data.RaidDebounce.Value = true
  117. startRaid()
  118. end
  119. end)
  120. game.Players.PlayerAdded:connect(function(player)
  121. if countPlayers(BrickColor.new('Bright red'))/countPlayers(BrickColor.new('Bright yellow')) >= 2 and data.RaidDebounce.Value == false then
  122. data.RaidOn.Value = true
  123. end
  124. end)
  125. game.Players.PlayerRemoving:connect(function(player)
  126. if countPlayers(BrickColor.new('Bright red'))/countPlayers(BrickColor.new('Bright yellow')) >= 2 and data.RaidDebounce.Value == false then
  127. data.RaidOn.Value = true
  128. end
  129. end)
  130. cp1db = true
  131. cp2db = true
  132. cp3db = true
  133. workspace.CP1.Touched:connect(function(hit)
  134. local db = false
  135. if hit ~= nil then
  136. if hit.Parent ~= nil and db ~= true then
  137. db = true
  138. print(hit.Parent.Name)
  139. if hit.Parent:FindFirstChild('Humanoid') then
  140. if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
  141. if hit.Parent:FindFirstChild('RaidData') then
  142. print('hello')
  143. if isTge(game.Players:GetPlayerFromCharacter(hit.Parent)) and data.PointStats.A.Owner.Value ~= BrickColor.new('Really red') then
  144. print('hi')
  145. capturePoint(workspace.CP1BGUI,workspace.CP1,game.Players:GetPlayerFromCharacter(hit.Parent),'A',cp1db,BrickColor.new('Really red'))
  146. workspace.CP1.TouchEnded:connect(function()
  147. if cp1db == true then
  148. print('out')
  149. cp1db = false
  150. end
  151. end)
  152. elseif game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new('Bright green') and data.PointStats.A.Value == BrickColor.new('Really red') then
  153. print('hi2')
  154. workspace.CP1.TouchEnded:connect(function()
  155. if cp1db == true then
  156. print('out')
  157. cp1db = false
  158. end
  159. end)
  160. repeat wait() until capturePoint(workspace.CP1BGUI,workspace.CP1,game.Players:GetPlayerFromCharacter(hit.Parent),'A',cp1db,BrickColor.new('Bright green')) == true
  161. db = false
  162. end
  163. end
  164. end
  165. end
  166. end
  167. end
  168. end)
  169. workspace.CP2.Touched:connect(function(hit)
  170. local db = false
  171. if hit ~= nil then
  172. if hit.Parent ~= nil and db ~= true then
  173. db = true
  174. print(hit.Parent.Name)
  175. if hit.Parent:FindFirstChild('Humanoid') then
  176. if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
  177. if hit.Parent:FindFirstChild('RaidData') then
  178. print('hello')
  179. if isTge(game.Players:GetPlayerFromCharacter(hit.Parent)) and data.PointStats.B.Owner.Value ~= BrickColor.new('Really red') then
  180. print('hi')
  181. repeat wait() until capturePoint(workspace.CP2BGUI,workspace.CP2,game.Players:GetPlayerFromCharacter(hit.Parent),'B',cp2db,BrickColor.new('Bright green')) == true
  182. db = false
  183. elseif game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new('Bright green') and data.PointStats.B.Value == BrickColor.new('Really red') then
  184. print('hi2')
  185. repeat wait() until capturePoint(workspace.CP2BGUI,workspace.CP2,game.Players:GetPlayerFromCharacter(hit.Parent),'B',cp2db,BrickColor.new('Bright green')) == true
  186. db = false
  187. end
  188. end
  189. end
  190. end
  191. end
  192. end
  193. end)
  194.  
  195. workspace.CP2.TouchEnded:connect(function()
  196. if cp2db == true then
  197. print('out')
  198. cp2db = false
  199. end
  200. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement