Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = script.Data --establish data folder variable for neat access ;)
- cps = {workspace.CP1,workspace.CP2,workspace.CP3}
- math.randomseed(tick())
- --thanks nstrike for the trello api
- function isTge(player)
- if player:IsInGroup(1180892) then
- return true
- else
- return false
- end
- end
- function wait10mins()
- local fucked = false
- for i=1,600 do
- 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
- wait(1)
- else
- fucked = true
- return false
- end break
- end
- if fucked == false then
- return true
- end
- end
- function capturePoint(point,touchpoint,player,pointletter,tpvar,tobeowner)
- print('in')
- local pvar = true
- if data.RaidOn.Value == true then
- point.CaptureGUI.Enabled = true
- local i = 0
- point.CaptureGUI.Frame.ProgressUnder.Size = UDim2.new(0,0,0,10)
- repeat wait()
- if tpvar == true then
- i = i + 1
- point.CaptureGUI.Frame.ProgressOver.Text = tostring(i)..'%'
- end
- until i == 100 or pvar == false or point.CaptureGUI.Frame.ProgressUnder.Size == UDim2.new(1,0,0,10) or tpvar == false
- print('IM DONE')
- print(tostring(pvar))
- print(tostring(tpvar))
- data.PointStats[pointletter].Value = tobeowner
- point.CaptureGUI:Destroy()
- local clone = point.CaptureGUICLONE:Clone()
- clone.Name = 'CaptureGUI'
- clone.Parent = point
- return true
- end
- end
- function countChildren(obj) --counts how many children an object has - because im lazy to do it every time
- if obj:GetChildren() ~= nil then
- local childcount = 0
- for i,v in pairs(obj:GetChildren()) do
- childcount = childcount + 1
- end
- return childcount
- end
- end
- function countPlayers(team)
- local count = 0
- for i,v in pairs(game.Players:GetChildren()) do
- if v.TeamColor == team then
- count = count + 1
- end
- end
- return count
- end
- function spawnR2(spawnmodel,r2model)
- if spawnmodel ~= nil then
- if spawnmodel.Parent ~= nil then
- local randomnum = math.random(1,countChildren(spawnmodel))
- if spawnmodel:FindFirstChild(tostring(randomnum)) ~= nil then
- if r2model ~= nil then
- print('lottery number: spawn no. '..randomnum)
- local clone = r2model:Clone()
- clone.Name = "R2CLONE"
- clone.Parent = workspace
- clone:MoveTo(spawnmodel[tostring(randomnum)].Position - Vector3.new(0,1,0))
- clone.TouchedUser.Changed:connect(function()
- if wait10mins() == false then
- print('TGE Victory')
- elseif wait10mins() then
- print('RAIDER Victory')
- end
- end)
- else
- spawnR2(spawnmodel)
- end
- end
- end
- end
- end
- function clearUpTheShit()
- if workspace:FindFirstChild('R2CLONE') ~= nil then
- workspace['R2CLONE']:Destroy()
- for i,v in pairs(cps) do
- for e,g in pairs(v:GetChildren()) do
- if string.find(g.ClassName,'Value') ~= nil then
- g.Value = 0
- if string.lower(g.Name) == string.lower('maxcaptime') then
- g.Value = data.CapTimePoints.Value
- end
- end
- end
- end
- end
- end
- function startRaid() --WHERE IT ALL STARTS BABY
- clearUpTheShit()
- spawnR2(game.Lighting.R2Spawns,game.Lighting.R2Model)
- end
- data.RaidOn.Changed:connect(function()
- if data.RaidOn.Value == true and data.RaidDebounce.Value ~= true then
- data.RaidDebounce.Value = true
- startRaid()
- end
- end)
- game.Players.PlayerAdded:connect(function(player)
- if countPlayers(BrickColor.new('Bright red'))/countPlayers(BrickColor.new('Bright yellow')) >= 2 and data.RaidDebounce.Value == false then
- data.RaidOn.Value = true
- end
- end)
- game.Players.PlayerRemoving:connect(function(player)
- if countPlayers(BrickColor.new('Bright red'))/countPlayers(BrickColor.new('Bright yellow')) >= 2 and data.RaidDebounce.Value == false then
- data.RaidOn.Value = true
- end
- end)
- cp1db = true
- cp2db = true
- cp3db = true
- workspace.CP1.Touched:connect(function(hit)
- local db = false
- if hit ~= nil then
- if hit.Parent ~= nil and db ~= true then
- db = true
- print(hit.Parent.Name)
- if hit.Parent:FindFirstChild('Humanoid') then
- if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
- if hit.Parent:FindFirstChild('RaidData') then
- print('hello')
- if isTge(game.Players:GetPlayerFromCharacter(hit.Parent)) and data.PointStats.A.Owner.Value ~= BrickColor.new('Really red') then
- print('hi')
- capturePoint(workspace.CP1BGUI,workspace.CP1,game.Players:GetPlayerFromCharacter(hit.Parent),'A',cp1db,BrickColor.new('Really red'))
- workspace.CP1.TouchEnded:connect(function()
- if cp1db == true then
- print('out')
- cp1db = false
- end
- end)
- elseif game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new('Bright green') and data.PointStats.A.Value == BrickColor.new('Really red') then
- print('hi2')
- workspace.CP1.TouchEnded:connect(function()
- if cp1db == true then
- print('out')
- cp1db = false
- end
- end)
- repeat wait() until capturePoint(workspace.CP1BGUI,workspace.CP1,game.Players:GetPlayerFromCharacter(hit.Parent),'A',cp1db,BrickColor.new('Bright green')) == true
- db = false
- end
- end
- end
- end
- end
- end
- end)
- workspace.CP2.Touched:connect(function(hit)
- local db = false
- if hit ~= nil then
- if hit.Parent ~= nil and db ~= true then
- db = true
- print(hit.Parent.Name)
- if hit.Parent:FindFirstChild('Humanoid') then
- if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
- if hit.Parent:FindFirstChild('RaidData') then
- print('hello')
- if isTge(game.Players:GetPlayerFromCharacter(hit.Parent)) and data.PointStats.B.Owner.Value ~= BrickColor.new('Really red') then
- print('hi')
- repeat wait() until capturePoint(workspace.CP2BGUI,workspace.CP2,game.Players:GetPlayerFromCharacter(hit.Parent),'B',cp2db,BrickColor.new('Bright green')) == true
- db = false
- elseif game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new('Bright green') and data.PointStats.B.Value == BrickColor.new('Really red') then
- print('hi2')
- repeat wait() until capturePoint(workspace.CP2BGUI,workspace.CP2,game.Players:GetPlayerFromCharacter(hit.Parent),'B',cp2db,BrickColor.new('Bright green')) == true
- db = false
- end
- end
- end
- end
- end
- end
- end)
- workspace.CP2.TouchEnded:connect(function()
- if cp2db == true then
- print('out')
- cp2db = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement