Guest User

Untitled

a guest
Oct 11th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.90 KB | None | 0 0
  1. Colors={"Dark green", "Brick yellow"}
  2. Radius=15
  3.  
  4. function playertotal()
  5.         local a,b=0,0
  6.         for i, x in pairs(game.Players:GetPlayers())do
  7.                 pcall(function()
  8.                         if x.Character.Humanoid.Health>0 and (x.Character:GetModelCFrame().p-script.Parent.Parent.Base.Position).magnitude<Radius then
  9.                                 if x.TeamColor==BrickColor.new(Colors[1]) then
  10.                                         a=a+1
  11.                                 elseif x.TeamColor==BrickColor.new(Colors[2]) then
  12.                                         b=b+1
  13.                                 end
  14.                         end
  15.                 end)
  16.         end
  17.         return a,b
  18. end
  19.  
  20. function flagtick()
  21.         if script.Parent.Capture.Value>=100 then
  22.                 script.Parent.Capture.Value=0
  23.                 if script.Parent.Owner.Value==BrickColor.new(Colors[1]) then
  24.                         script.Parent.Owner.Value=BrickColor.new(Colors[2])
  25.                 elseif script.Parent.Owner.Value==BrickColor.new(Colors[2]) then
  26.                         script.Parent.Owner.Value=BrickColor.new(Colors[1])
  27.                 else
  28.                         local a,b=playertotal()
  29.                         script.Parent.Owner.Value=BrickColor.new(a>b and Colors[1] or a<b and Colors[2])                      
  30.                 end
  31.         end
  32.        
  33.         local a,b=playertotal()
  34.         if (a>b and script.Parent.Owner.Value~=BrickColor.new(Colors[1])) or (b>a and script.Parent.Owner.Value~=BrickColor.new(Colors[2])) then
  35.                 script.Parent.Capture.Value=script.Parent.Capture.Value+1
  36.         end
  37.         if ((a>b and script.Parent.Owner.Value==BrickColor.new(Colors[1])) or (b>a and script.Parent.Owner.Value==BrickColor.new(Colors[2]))) and script.Parent.Capture.Value>0 then
  38.                 script.Parent.Capture.Value=script.Parent.Capture.Value-1
  39.         end
  40.        
  41.         script.Parent.BrickColor=script.Parent.Owner.Value
  42.         for i, x in pairs(script.Parent.Parent.Sandbags:children()) do
  43.                 x.BrickColor=script.Parent.Owner.Value
  44.         end
  45.        
  46.         script.Parent.BillboardGui.Frame.BackgroundColor3=Color3.new(script.Parent.Owner.Value.Color.r-.2,script.Parent.Owner.Value.Color.g-.2,script.Parent.Owner.Value.Color.b-.2)
  47.         script.Parent.BillboardGui.Frame.Frame.BackgroundColor3=script.Parent.Owner.Value.Color
  48.        
  49.         script.Parent.BillboardGui.Frame.Frame.Frame:TweenSize(UDim2.new(script.Parent.Capture.Value/100,0,1,0),"Out","Linear",.2,true)
  50.         script.Parent.BillboardGui.Frame.Frame.Frame.BackgroundColor3=(script.Parent.Owner.Value==BrickColor.new(Colors[1])) and BrickColor.new(Colors[1]).Color or (script.Parent.Owner.Value==BrickColor.new(Colors[2])) and BrickColor.new(Colors[2]).Color or BrickColor.new("Black").Color
  51. end
  52. script.Parent.BillboardGui.Adornee=script.Parent
  53. while wait(.1) do
  54.         flagtick()
  55. end
Advertisement
Add Comment
Please, Sign In to add comment