Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.43 KB | None | 0 0
  1. local States = {"Central Powers", "Allies", "International White"}
  2. local isCapped = false
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local RemoteEvent = game.ReplicatedStorage.Capture
  5. local Cooldown = false
  6. local teamCapped = States[3]
  7. local announce = game.StarterGui.CaptureAnn.Frame.CaptureAnnouncement
  8. local color     = Color3.new
  9. local colorsq   = ColorSequence.new
  10. local bc        = BrickColor.new
  11. local wfc = game.WaitForChild
  12. local flag = script.Parent
  13. local base = wfc(flag, "Base")
  14. local pt = wfc(flag, "Particles")
  15. local c1        =wfc(flag,"Circle")
  16. local c2        =wfc(flag,"Circle2")
  17. local c3        =wfc(flag,"Circle3")
  18. local tm        =wfc(flag,"TeamColor")
  19. local fg        =wfc(flag,"Flag")
  20. local sp        =wfc(fg,"Spot")
  21. local dt        =wfc(sp,"A")
  22. local areaname = script.Parent.areaname.Value
  23.  
  24. local cloud = pt.Cloud
  25. local flame = pt.Flame
  26. local light = pt.PointLight
  27. local text = script.Parent.Flag.Spot.A
  28.  
  29. local function updateColor()
  30.     if teamCapped == States[3] then
  31.         cloud.Color = colorsq(color(1,1,1),color(0,0,0))
  32.         flame.Color = colorsq(color(1,1,1),color(1,1,1))
  33.         light.Color = color(1,1,1)
  34.         dt.BackgroundColor3 = color(1,1,1)
  35.         c1.BrickColor = bc("White")
  36.         c2.BrickColor = bc("White")
  37.         c3.BrickColor = bc("White")
  38.         text.TextColor3 = Color3.fromRGB(255,255,255)
  39.     else
  40.         cloud.Color = colorsq(tm.Value.Color,color(0,0,0))
  41.         flame.Color = colorsq(tm.Value.Color,color(1,1,1))
  42.         light.Color = tm.Value.Color
  43.         dt.BackgroundColor3 = tm.Value.Color
  44.         c1.BrickColor = tm.Value
  45.         c2.BrickColor = tm.Value
  46.         c3.BrickColor = tm.Value
  47.     end
  48. end
  49.  
  50. updateColor()
  51.  
  52. local touch = script.Parent.touch
  53. touch.Touched:Connect(function(hit)
  54.     if hit.Parent:FindFirstChild("Humanoid") then
  55.         if not Cooldown then
  56.             Cooldown = true
  57.             local team = game.Players:GetPlayerFromCharacter(hit.Parent).Team.Name
  58.             if team == teamCapped then
  59.                 Cooldown = false
  60.                 return
  61.             else
  62.                 if team == States[1] then
  63.                     print('CP')
  64.                     game.Workspace.Whistle:Play()
  65.                     script.Parent.cloth.BrickColor = BrickColor.new("Dark stone grey")
  66.                     for i = 1, 10 do
  67.                         wait(1)
  68.                         teamCapped = States[1]
  69.                         tm.Value = bc("Bright green")
  70.                         text.TextColor3 = Color3.fromRGB(0,155,0)
  71.                         updateColor()
  72.                         wait(1)
  73.                         teamCapped = States[3]
  74.                         tm.Value = bc("International White")
  75.                         updateColor()
  76.                     end
  77.                     teamCapped = States[1]
  78.                     tm.Value = bc("Bright green")
  79.                     game.Workspace.Whistle_Captured:Play()
  80.                     script.Parent.cloth.flagcp1.Transparency = 0.8
  81.                     script.Parent.cloth.flagcp2.Transparency = 0.8
  82.                     text.TextColor3 = Color3.fromRGB(0,155,0)
  83.                     updateColor()
  84.                 elseif team == States[2] then
  85.                     print('allies')
  86.                     game.Workspace.Whistle:Play()
  87.                     script.Parent.cloth.BrickColor = BrickColor.new("Bright blue")
  88.                    
  89.                     for i = 1, 10 do
  90.                         wait(1)
  91.                         teamCapped = States[2]
  92.                         tm.Value = bc("Bright blue")
  93.                         text.TextColor3 = Color3.fromRGB(0,85,255)
  94.                         updateColor()
  95.                         wait(1)
  96.                         teamCapped = States[3]
  97.                         tm.Value = bc("International White")
  98.                         updateColor()
  99.                     end
  100.                     teamCapped = States[2]
  101.                     tm.Value = bc("Bright blue")
  102.                     game.Workspace.Whistle_Captured:Play()
  103.                     RemoteEvent:FireAllClients()
  104.                    
  105.                     script.Parent.cloth.flaguk1.Transparency = 0.8
  106.                     script.Parent.cloth.flaguk2.Transparency = 0.8
  107.                     text.TextColor3 = Color3.fromRGB(0,85,255)
  108.                     updateColor()
  109.                 end
  110.            
  111.                 Cooldown = false
  112.             end    
  113.         end
  114.     end
  115. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement