Guest User

Untitled

a guest
Jan 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. print("TeamSetting Enabled I love you iRykorz")
  2. s1 = false
  3. s2 = false
  4. s3 = false
  5. s4 = false
  6. sd = false
  7. function onChat(text,recep)
  8. finaltext=string.lower(text)
  9. s1 = false
  10. s2 = false
  11. s3 = false
  12. s4 = false
  13. sX = false
  14. if string.find(finaltext, "computer")~= nil then
  15. s1 = true
  16. if string.find(finaltext, "randomise")~= nil then
  17. s2 = true
  18. end
  19. if string.find(finaltext, "teams")~= nil then
  20. s3 = true
  21. end
  22. if string.find(finaltext, "reset")~= nil then
  23. s4 = true
  24. end
  25. end
  26.  
  27. if s4 == true then
  28. sX = true
  29. end
  30.  
  31. if s1 == true and s2 == true and s3 == true and sX == false then
  32. Randomise()
  33. elseif s1 == true and s3 == true and sX == true then
  34. ResetTeams()
  35. end
  36.  
  37. end
  38. function Randomise()
  39. if sd == false then
  40. sd = true
  41. local colors = {"Bright red","Bright blue"}
  42. nump = {
  43. ["Bright red"] = 0;
  44. ["Bright blue"] = 0;
  45. }
  46. for _,v in pairs(game.Players:GetPlayers()) do
  47. if v.TeamColor ~= BrickColor.new("Bright violet") or v.TeamColor ~= BrickColor.new("Dark stone grey") then
  48. r = math.random(1,2)
  49. v.TeamColor = BrickColor.new(colors[r])
  50. nump[colors[r]] = nump[colors[r]] + 1
  51. end
  52. end
  53. repeat
  54. wait()
  55. if nump["Bright red"] > nump["Bright blue"] then
  56. p = game.Players:GetPlayers()
  57. for i = 1,#p do
  58. if p[i].TeamColor == BrickColor.new("Bright red") then
  59. p[i].TeamColor = BrickColor.new("Bright blue")
  60. nump["Bright red"] = nump["Bright red"] - 1
  61. nump["Bright blue"] = nump["Bright blue"] + 1
  62. break
  63. end
  64. end
  65. elseif nump["Bright red"] < nump ["Bright blue"] then
  66. p = game.Players:GetPlayers()
  67. for i = 1,#p do
  68. if p[i].TeamColor == BrickColor.new("Bright red") then
  69. p[i].TeamColor = BrickColor.new("Bright blue")
  70. nump["Bright red"] = nump["Bright red"] + 1
  71. nump["Bright blue"] = nump["Bright blue"] - 1
  72. break
  73. end
  74. end
  75. end
  76. end
  77. until
  78. nump["Bright red"] - nump["Bright blue"] <= 1 and nump["Bright blue"] - nump["Bright red"] <= 1
  79. end
  80.  
  81. function ResetTeams()
  82. if sd == true then
  83. sd = false
  84. for _,v in pairs(game.Players:GetPlayers()) do
  85. if v.TeamColor ~= BrickColor.new("Bright violet") then
  86. v.TeamColor = BrickColor.new("Bright green")
  87. end
  88. end
  89. end
  90. end
Add Comment
Please, Sign In to add comment