alpayspastbin

Untitled

May 28th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. -- NINGAKIWI
  2.  
  3.  
  4.  
  5. disasters = {"Zombies","Meteor","Tsunami","Exploding Zombies","Bowling","Nuke Bomb","Sky is falling","Volcano","Bigfoot","Killbot","Rock Slide","Moon","UFO","Alien","Plane Crash","Chomper","My Little Sister","Radiation","Lava","Quicksand","Epic Duck","Ice Rain","Kirby","Goomba","Plane Crash","Tornado","Alien Tank", "Disaster"} -- This is where you list the names models that you want to use for disasters.
  6.  
  7. -- Disaster names are case-sensitive and all disaster models must be in the lighting
  8.  
  9.  
  10.  
  11. countdownTime = 60 -- Time between disasters.
  12.  
  13. disasterTime = 40 -- The ammount of time that the disaster will be in the game before it is removed.
  14.  
  15.  
  16.  
  17. countdownMessage = "Next disaster in %s seconds!" -- The message displayed between disasters. %s will be replaced with the number of seconds left.
  18.  
  19. disasterMessage = "Disaster: %s" -- The message displayed when a disaster occurs. %s will be replaced with the disaster name. Set to nil if you do not want a message
  20.  
  21.  
  22.  
  23. -- Unless you know what you are doing, please leave the below code alone.
  24.  
  25. items = {}
  26.  
  27. leaderboard = game.Workspace:findFirstChild("BTS Leaderboard") -- Dont need to use with Ajedi´s BTS leaderboard, but if you want...
  28.  
  29. local w = game.Workspace:getChildren()
  30.  
  31. for i=1,#w do
  32.  
  33. if w[i].Name == "leaderboard" and w[i]:findFirstChild("running") ~= nil and w[i]:findFirstChild("points") ~= ni then
  34.  
  35. leaderboard = w[i]
  36.  
  37. end
  38.  
  39. end
  40.  
  41. for i=1,#disasters do
  42.  
  43. local item = game.Lighting:findFirstChild(disasters[i])
  44.  
  45. if item ~= nil then
  46.  
  47. item.Parent = nil
  48.  
  49. table.insert(items, item)
  50.  
  51. else
  52.  
  53. print("Error! ", disasters[i], " was not found!")
  54.  
  55. end
  56.  
  57. end
  58.  
  59.  
  60.  
  61. function chooseDisaster()
  62.  
  63. return items[math.random(#items)]
  64.  
  65. end
  66.  
  67.  
  68.  
  69. function sethint(text)
  70.  
  71. local hint = game.Workspace:findFirstChild("hint")
  72.  
  73. if (hint ~= nil) then
  74.  
  75. hint.Text = text
  76.  
  77. else
  78.  
  79. print("Hint does not exist, creating...")
  80.  
  81. h = Instance.new("Hint")
  82.  
  83. h.Name = "hint"
  84.  
  85. h.Text = text
  86.  
  87. h.Parent = game.Workspace
  88.  
  89. end
  90.  
  91. --print("Hint set to: ", text)
  92.  
  93. end
  94.  
  95.  
  96.  
  97. function removeHint()
  98.  
  99. hint = game.Workspace:findFirstChild("hint")
  100.  
  101. if (hint ~= nil) then hint:remove() end
  102.  
  103. end
  104.  
  105.  
  106.  
  107. function countdown(time)
  108.  
  109. sethint(string.format(countdownMessage, tostring(time)))
  110.  
  111. while (time > 0) do
  112.  
  113. wait(1)
  114.  
  115. time = time - 1
  116.  
  117. sethint(string.format(countdownMessage, tostring(time)))
  118.  
  119. end
  120.  
  121. removeHint()
  122.  
  123. return true
  124.  
  125. end
  126.  
  127.  
  128.  
  129. while true do
  130.  
  131. countdown(countdownTime)
  132.  
  133.  
  134.  
  135. if leaderboard ~= nil and leaderboard:findFirstChild("running") and leaderboard:findFirstChild("points") then
  136.  
  137. leaderboard.points.Value = 30
  138.  
  139. leaderboard.running.Value = true
  140.  
  141. end
  142.  
  143.  
  144.  
  145. local m = chooseDisaster():clone()
  146.  
  147.  
  148.  
  149. if disasterMessage ~= nil then
  150.  
  151. local msg = Instance.new("Message")
  152.  
  153. msg.Name = "DisasterMsg"
  154.  
  155. msg.Text = string.format(disasterMessage, m.Name)
  156.  
  157. msg.Parent = game.Workspace
  158.  
  159. wait(3)
  160.  
  161. msg.Parent = nil
  162.  
  163. end
  164.  
  165.  
  166.  
  167. m.Parent = game.Workspace
  168.  
  169. m:makeJoints()
  170.  
  171. wait(disasterTime)
  172.  
  173. m:remove()
  174.  
  175.  
  176.  
  177. if leaderboard ~= nil then
  178.  
  179. leaderboard.running.Value = false
  180.  
  181. end
  182.  
  183. end
Add Comment
Please, Sign In to add comment