Advertisement
Guest User

main code

a guest
May 25th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.73 KB | None | 0 0
  1. print("Loading Scream by xxdemonslayer12xx2")
  2. print("All copyrights served © ")
  3. print("-----------------------------------------------")
  4. wait(1)
  5. print("MAINSCRIPT '"..script.Name.."' LOADED")
  6.  
  7. local swipe = script.Swipe
  8. local trumpets = script.Trumpets
  9. local bells = script.ScaryBells
  10. local musicbells = script.Bells
  11. amountchecked = script.AmountChecked
  12. local maps = game.Lighting.Maps:GetChildren()
  13. local pickedMap = nil
  14. local h = Instance.new("Hint")
  15. local m = Instance.new("Message")
  16. local plyrs = 2-- least amount of players needed to play
  17. local it = nil -- nothing
  18. local PlayerItName = game.Workspace.PlayerItName
  19. local ViewItTrueorFalse = game.Workspace.ViewIt
  20. local sherrif = nil
  21. timerlele = script.TimerCountdown
  22.  
  23. function round(a,b)
  24. return math.floor((a/b)+0.5)*b
  25. end
  26.  
  27. function findAlive()
  28. wait(1)
  29. timerlele.Value = timerlele.Value - 1
  30. amountchecked.Value = amountchecked.Value + 1
  31. local alive = 0
  32. local playerLIST = game.Players:GetChildren()
  33. for i = 1, #playerLIST do
  34. if playerLIST[i].Alive.Value == true then
  35. alive = alive + 1
  36. end
  37. end
  38. if alive == 0 then
  39. h.Parent = game.Workspace
  40. h.Text = it.Name.. " murdered all the targets."
  41. wait(4)
  42. if it ~= nil then
  43. it.leaderstats.Points.Value = it.leaderstats.Points.Value + 50
  44. wait(2)
  45. h:remove()
  46. EndGame()
  47. end
  48. end
  49. end
  50.  
  51.  
  52. function EndGame()
  53. timerlele.Value = 250
  54. amountchecked.Value = 0
  55. local alive = 0
  56. local playerLIST = game.Players:GetChildren()
  57. for i = 1, #playerLIST do
  58. if playerLIST[i].Alive.Value == true then
  59. playerLIST[i].leaderstats.Points.Value = playerLIST[i].leaderstats.Points.Value + 20
  60. end
  61. end
  62. game.Lighting.TimeOfDay = "14:00:00"
  63. musicbells:stop()
  64. game.Lighting.FogEnd = 100000000
  65. local list = game.Players:children()
  66. for i = 1, #list do
  67. if list[i].Character ~= nil then
  68. list[i].Character:BreakJoints()
  69. end
  70. end
  71. pickedMap:remove()
  72. local minutes = 0
  73. local seconds = 30
  74. h.Parent = game.Workspace
  75. for i = 1, (minutes+1) do
  76. for i = 1, (seconds+1) do
  77. if seconds < 10 then
  78. h.Text = seconds.." Seconds ,Screams starting soon!"
  79. else
  80. h.Text = seconds.." seconds till Scream starts!"
  81. end
  82. seconds = seconds - 1
  83. wait(1)
  84. end
  85. seconds = 40
  86. minutes = minutes - 1
  87. end
  88. h:remove()
  89. CheckPlayers()
  90. end
  91.  
  92.  
  93. function ItCountDown()
  94. local walls = game.Workspace.Walls:GetChildren()
  95. for i = 1,#walls do if walls[i].className == "Part" then walls[i].Transparency = 0.5 end end
  96. h.Parent = game.Workspace
  97. repeat
  98. h.Text = "There is " .. timerlele.Value .. " more seconds before scream leaves!"
  99. findAlive()
  100. until timerlele.Value == 0
  101. m.Parent = game.Workspace
  102. m.Text = "scream has left."
  103. wait(3)
  104. m:remove()
  105. PlayerItName.Value = ""
  106. ViewItTrueorFalse.Value = false
  107. EndGame()
  108. end
  109.  
  110. function Teleport_It()
  111. if it ~= nil then
  112. if it.Character ~= nil then
  113. if it.Character.Humanoid.Health > 0 then
  114. head = it.Character.Head
  115. newhead = head:Clone()
  116. neck = it.Character.Torso.Neck
  117. newneck = neck:Clone()
  118. newhead.Name = "NewHead"
  119. newhead.Parent = it.Character
  120. newneck.Name = "NewNeck"
  121. newneck.Part0 = it.Character.Torso
  122. newneck.Part1 = newhead
  123. newneck.Parent = it.Character.Torso
  124. it.Character.Humanoid.WalkSpeed = 25
  125. tt = game.Lighting.BillboardGui:Clone()
  126. tt.Parent = it.Character
  127. local flightly = game.Lighting.ThrowingKnife:Clone()
  128. flightly.Parent = it.Backpack
  129. local s = game.Lighting.ItScript:Clone()
  130. s.Parent = it.Character
  131. s.owner.Value = it.Name
  132. s.Repeater.Disabled = false
  133. local location = pickedMap.ItSpawn
  134. it.Character.Humanoid.Jump = true
  135. wait()
  136. it.Character.Torso.CFrame = CFrame.new(Vector3.new(location.Position.x,location.Position.y + 3,location.Position.z))
  137. bells:play()
  138. wait(0.2)
  139. musicbells:play()
  140. end
  141. end
  142. ItCountDown()
  143. else
  144. h.Text = it.Name.. " Has Died!"
  145. wait(2)
  146. h.Text = "Innocent's Have won!!"
  147. wait(2)
  148. h:remove()
  149. end
  150. EndGame()
  151. end
  152.  
  153. function Teleport_Sherrif()
  154. if sherrif ~= nil then
  155. if sherrif.Character ~= nil then
  156. if sherrif.Character.Humanoid.Health > 0 then
  157. head = sherrif.Character.Head
  158. newhead = head:Clone()
  159. neck = sherrif.Character.Torso.Neck
  160. newneck = neck:Clone()
  161. newhead.Name = "NewHead"
  162. newhead.Parent = sherrif.Character
  163. newneck.Name = "NewNeck"
  164. newneck.Part0 = sherrif.Character.Torso
  165. newneck.Part1 = newhead
  166. newneck.Parent = sherrif.Character.Torso
  167. sherrif.Character.Humanoid.WalkSpeed = 25
  168. tt = game.Lighting.BillboardGui:Clone()
  169. tt.Parent = sherrif.Character
  170. local flightly = game.Lighting.Revolver:Clone()
  171. flightly.Parent = sherrif.Backpack
  172. local s = game.Lighting.Revolver:Clone()
  173. s.Parent = sherrif.Character
  174. s.owner.Value = sherrif.Name
  175. s.Repeater.Disabled = false
  176. local location = pickedMap.SherrifSpawn
  177. sherrif.Character.Humanoid.Jump = true
  178. wait()
  179. sherrif.Character.Torso.CFrame = CFrame.new(Vector3.new(location.Position.x,location.Position.y + 3,location.Position.z))
  180.  
  181. end
  182. end
  183. else
  184.  
  185. h:remove()
  186. end
  187. EndGame()
  188. end
  189.  
  190.  
  191. function HideCountDown()
  192. game.Lighting.TimeOfDay = "0:00:00"
  193. game.Lighting.FogEnd = 250
  194. local minutes = 0 -- how many minutes hiders have to hide
  195. local seconds = 59 -- how many seconds hiders have to hide
  196. h.Parent = game.Workspace
  197. for i = 1, (minutes+1) do
  198. for i = 1, (seconds+1) do
  199. if seconds < 10 then
  200. h.Text = "There is "..seconds.." more seconds before scream is released."
  201. else
  202. h.Text = "There is "..seconds.." more seconds before scream is released."
  203. end
  204. seconds = seconds - 1
  205. wait(1)
  206. end
  207. seconds = 59
  208. minutes = minutes - 1
  209. end
  210. h:remove()
  211. m.Parent = game.Workspace
  212. m.Text = "Release scream."
  213. wait(2)
  214. m:remove()
  215. Teleport_It()
  216. Teleport_Sherrif()
  217. end
  218.  
  219. function Choose_It()
  220. local list = game.Players:GetChildren()
  221. h.Parent = game.Workspace
  222. local f = 1
  223. local random = math.random(30,45)
  224. for i = 1, random do
  225. it = list[f]
  226. h.Text = "Choosing killer: "..it.Name
  227. swipe:play()
  228. wait()
  229. f = f + 1
  230. if f > #list then
  231. f = 1
  232. end
  233. wait(0.2)
  234. end
  235. h.Text = "The killer is " ..it.Name.. "!"
  236. trumpets:play()
  237. wait(4)
  238. PlayerItName.Value = it.Name
  239. ViewItTrueorFalse.Value = true
  240. m:remove()
  241. Choose_Sherrif()
  242. end
  243.  
  244. function Choose_Sherrif()
  245. local list = game.Players:GetChildren()
  246. h.Parent = game.Workspace
  247. local f = 1
  248. local random = math.random(30,45)
  249. for i = 1, random do
  250. it = list[f]
  251. h.Text = "Choosing Sherrif: "..sherrif.Name
  252. swipe:play()
  253. wait()
  254. f = f + 1
  255. if f > #list then
  256. f = 1
  257. end
  258. wait(0.2)
  259. end
  260. h.Text = "The Sherrif is " ..sherrif.Name.. "!"
  261. trumpets:play()
  262. wait(4)
  263. PlayerItName.Value = sherrif.Name
  264. m:remove()
  265. Start()
  266. end
  267.  
  268. function Start()
  269. h.Parent = game.Workspace
  270. local players = game.Players:GetChildren()
  271. local spawns = pickedMap.Spawns:GetChildren()
  272. local d = 1
  273. for x = 1, #players do
  274. if players[x] ~= it then
  275. if players[x].Character ~= nil then
  276. if players[x].Character.Humanoid.Health > 0 then
  277. players[x].Alive.Value = true
  278. players[x].Character.Head.Transparency = 1
  279. h.Text = "Preparing "..players[x].Name
  280. local location = spawns[d]
  281. players[x].Character.Humanoid.Jump = true
  282. game.Lighting.Spectate:clone().Parent = players[x].Backpack
  283. game.Lighting.Flashlight:clone().Parent = players[x].Backpack
  284. players[x].Character.Torso.CFrame = CFrame.new(Vector3.new(location.Position.x,location.Position.y + 3,location.Position.z))
  285. wait(0.2)
  286. end
  287. end
  288. end
  289. d = d + 1
  290. if d > #spawns then
  291. d = 1
  292. end
  293. end
  294. local walls = game.Workspace.Walls:GetChildren()
  295. for i = 1,#walls do if walls[i].className == "Part" then walls[i].Transparency = 0 end end
  296. HideCountDown()
  297. end
  298.  
  299. function Choose_Level()
  300. h.Parent = game.Workspace
  301. local pM = maps[math.random(1, #maps)]
  302. pickedMap = pM:clone()
  303. pickedMap.Parent = game.Workspace
  304. h.Parent = game.Workspace
  305. h.Text = "Choosing Map: "..pickedMap.Name
  306. wait(6)
  307. h:remove()
  308. Choose_It()
  309. end
  310.  
  311. function CheckPlayers()
  312. if game.Players.NumPlayers < plyrs then
  313. h.Parent = game.Workspace
  314. h.Text = "Not enough members to start!"
  315. wait(1)
  316. CheckPlayers()
  317. else
  318. h.Parent = game.Workspace
  319. h.Text = "Welcome to SCREAM!"
  320. wait(4)
  321. h.Text = "SCREAM is about to start."
  322. wait(2)
  323. h:remove()
  324. Choose_Level()
  325. end
  326. end
  327.  
  328. wait(1)
  329. CheckPlayers()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement