Advertisement
Modii

Untitled

Feb 26th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.35 KB | None | 0 0
  1. local Tool = script.Parent;
  2.  
  3. autolength = 5
  4. enabled = true
  5. enabled2 = true
  6. benabled = true
  7. pgui = nil
  8. mtarg = nil
  9. mousedown = false
  10. target = nil
  11. cart = true
  12. electrictextures = {"http://www.roblox.com/asset/?id=109201383", "http://www.roblox.com/asset/?id=109201366", "http://www.roblox.com/asset/?id=109201474", "http://www.roblox.com/asset/?id=109201980", "http://www.roblox.com/asset/?id=109202011"}
  13.  
  14. function BarbTouched(hit, barb)
  15. if hit == nil then return end
  16. if hit.Parent == nil then return end
  17. if hit.Parent:findFirstChild("Humanoid") or hit.Parent:findFirstChild("Zombie") ~= nil then
  18. if hit.Parent.Name == game.Players.LocalPlayer.Name then return end
  19. if target ~= nil then return end
  20.  
  21. if hit.Parent:findFirstChild("OverrideScript") == nil then
  22. local s = script.Parent.OverrideScript:clone()
  23. s.Parent = hit.Parent
  24. target = hit.Parent
  25. s.Disabled = false
  26.  
  27. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  28. Tool.LineV.Value = true
  29. Line = Instance.new("SelectionPartLasso")
  30. print("line")
  31. Line.Name = "strings"
  32. Line.Color = BrickColor.new("Black")
  33. Line.Humanoid = hit.Parent:findFirstChild("Humanoid")
  34. Line.Part = Tool.Electric
  35. Line.Parent = target
  36. end
  37. elseif hit.Parent:findFirstChild("Zombie") ~= nil then
  38. Tool.LineV.Value = true
  39.  
  40. Linez = Instance.new("SelectionPartLasso")
  41. Linez.Name = "strings"
  42. Linez.Color = BrickColor.new("Black")
  43. Linez.Humanoid = hit.Parent:findFirstChild("Zombie")
  44. Linez.Part = Tool.Electric
  45. Linez.Parent = target
  46.  
  47. end
  48.  
  49. barb:Remove()
  50.  
  51. elseif hit.CanCollide == true then
  52. barb:Remove()
  53. end
  54. end
  55.  
  56. function DriveStun(hit)
  57. if hit.Parent:findFirstChild("Humanoid") or hit.Parent:findFirstChild("Zombie") ~= nil then
  58. local s = script.Parent.DriveStunScript:clone()
  59. s.Parent = hit.Parent
  60. s.Disabled = false
  61. end
  62. end
  63.  
  64. function GetElectricTexture()
  65. local r = math.random(1,#electrictextures)
  66. return electrictextures[r]
  67. end
  68.  
  69. function onButton1Down(mouse)
  70. mousedown = true
  71. if not enabled then
  72. return
  73. end
  74. if not enabled2 then return end
  75. enabled = false
  76. enabled2 = false
  77.  
  78. if mouse.Hit ~= nil then
  79. mtarg = mouse.Hit.p
  80. end
  81.  
  82. if cart and benabled then
  83. benabled = false
  84. Tool.Deployed.Value = true
  85. local v = (mtarg - Tool.Cart.Position).unit
  86. local v2 = ((mtarg + Vector3.new(0,-1.5,0)) - Tool.Cart.Position).unit
  87.  
  88. local spawnPos = script.Parent.Cart.Position
  89. spawnPos = spawnPos + (v * 2)
  90.  
  91. Tool.BlastDoor1.Transparency = 1
  92. Tool.BlastDoor2.Transparency = 1
  93.  
  94. local barb_1 = Instance.new("Part")
  95.  
  96. barb_1.Position = spawnPos
  97. barb_1.FormFactor = 3
  98. barb_1.Size = Vector3.new(1,1,1)
  99. barb_1.Velocity = v * 500--1000
  100. barb_1.BrickColor = BrickColor.new(194)
  101. barb_1.BottomSurface = 0
  102. barb_1.TopSurface = 0
  103. barb_1.Name = "TaserBarb"
  104. barb_1.Elasticity = 0
  105. barb_1.Reflectance = 0.1
  106. barb_1.Friction = 1
  107. Tool.BarbMesh:clone().Parent = barb_1
  108.  
  109.  
  110. local sc = Tool.BarbScript:clone()
  111. sc.Parent = barb_1
  112. sc.Disabled = false
  113.  
  114. local force = Instance.new("BodyForce")
  115. force.force = Vector3.new(0,150,0)
  116. force.Parent = barb_1
  117.  
  118. barb_1.Parent = game.Workspace
  119.  
  120. local barb_2 = barb_1:clone()
  121. barb_2.Position = spawnPos + (v2 * 2) + Vector3.new(0,-0.5,0)
  122. barb_2.Velocity = v2 * 500
  123. barb_2.BodyForce.force = Vector3.new(0,150,0)
  124. barb_2.Parent = game.Workspace
  125.  
  126. barb_1.Touched:connect(function(hit) BarbTouched(hit, barb_1) end)
  127. barb_2.Touched:connect(function(hit) BarbTouched(hit, barb_2) end)
  128. Tool.Handle.Shot:Play()
  129.  
  130. local al = 70 * (autolength / 5) + 2
  131. local t = 0
  132. local timerval = 0
  133.  
  134. coroutine.resume(coroutine.create(function()
  135. while not enabled do
  136. t = t + 0.1
  137. if t < autolength then
  138. Tool.TimerVal.Value = math.ceil(autolength - t)
  139. else
  140. Tool.TimerVal.Value = math.ceil(t)
  141. end
  142. wait(0.1)
  143. end
  144. Tool.TimerVal.Value = 0
  145. end))
  146.  
  147. while (mousedown or t < autolength - 0.2) and not safety and t < 90 do
  148. script.Parent.Handle.sound:Play()
  149. script.Parent.Handle.sound2:Play()
  150. script.Parent.Handle.sound3:Play()
  151. wait(0.06)
  152. end
  153.  
  154. if target ~= nil then
  155. if target:findFirstChild("OverrideScript") ~= nil then target.OverrideScript:Remove() end
  156. end
  157.  
  158. Tool.TimerVal.Value = 0
  159. safety = false
  160. enabled = true
  161. wait(0.2)
  162. enabled2 = true
  163.  
  164. elseif cart and target ~= nil then
  165.  
  166. enabled = false
  167. local st = script.Parent.OverrideScript:clone()
  168. st.Disabled = false
  169. st.Parent = target
  170.  
  171. local al = 70 * (autolength / 5) + 2
  172. local t = 0
  173. local timerval = 0
  174.  
  175. coroutine.resume(coroutine.create(function()
  176. while not enabled do
  177. t = t + 0.1
  178. if t < autolength then
  179. Tool.TimerVal.Value = math.ceil(autolength - t)
  180. else
  181. Tool.TimerVal.Value = math.ceil(t)
  182. end
  183. wait(0.1)
  184. end
  185. Tool.TimerVal.Value = 0
  186. end))
  187.  
  188. while (mousedown or t < autolength - 0.2) and not safety and t < 90 do
  189. script.Parent.Handle.sound:Play()
  190. script.Parent.Handle.sound2:Play()
  191. script.Parent.Handle.sound3:Play()
  192. wait(0.06)
  193. end
  194.  
  195. if target ~= nil then
  196. if target:findFirstChild("OverrideScript") ~= nil then target.OverrideScript:Remove() end
  197. end
  198.  
  199. Tool.TimerVal.Value = 0
  200. safety = false
  201. enabled = true
  202. wait(0.2)
  203. enabled2 = true
  204.  
  205. elseif not cart then
  206.  
  207. enabled = false
  208. local con2 = script.Parent.Cart.Touched:connect(DriveStun)
  209.  
  210. local al = 70 * (autolength / 5) + 2
  211. local t = 0
  212.  
  213. coroutine.resume(coroutine.create(function()
  214. while not enabled do
  215. t = t + 0.1
  216. if t < autolength then
  217. Tool.TimerVal.Value = math.ceil(autolength - t)
  218. else
  219. Tool.TimerVal.Value = math.ceil(t)
  220. end
  221. wait(0.1)
  222. end
  223. Tool.TimerVal.Value = 0
  224. end))
  225.  
  226. while (mousedown or t < autolength - 0.2) and not safety and t < 90 do
  227. Tool.Electric.Decal.Texture = GetElectricTexture()
  228. script.Parent.Handle.sound:Play()
  229. script.Parent.Handle.sound2:Play()
  230. script.Parent.Handle.sound3:Play()
  231. wait(0.06)
  232. end
  233.  
  234. Tool.Electric.Decal.Texture = ""
  235. con2:disconnect()
  236.  
  237. Tool.TimerVal.Value = 0
  238. safety = false
  239. enabled = true
  240. wait(0.2)
  241. enabled2 = true
  242. else
  243. enabled = true
  244. enabled2 = true
  245. end
  246. end
  247.  
  248. function onButton1Up(mouse)
  249. mousedown = false
  250. end
  251.  
  252. function UpdateDisplay()
  253. if pgui == nil then return end
  254. if Tool.TimerVal.Value == 0 then
  255. pgui.Main.Countdown.Text = ""
  256. else
  257. pgui.Main.Countdown.Text = Tool.TimerVal.Value
  258. end
  259. if Tool.Cartr.Value == false then
  260. pgui.Main.CartStatus.BackgroundColor3 = Color3.new(255,255,255)
  261. pgui.Main.CartStatus.BorderColor3 = Color3.new(255,255,255)
  262. pgui.Main.CartStatus.Text = "-"
  263. elseif Tool.Deployed.Value == true then
  264. pgui.Main.CartStatus.BackgroundColor3 = Color3.new(255,255,255)
  265. pgui.Main.CartStatus.BorderColor3 = Color3.new(255,0,0)
  266. pgui.Main.CartStatus.Text = "X"
  267. else
  268. pgui.Main.CartStatus.BackgroundColor3 = Color3.new(255,255,255)
  269. pgui.Main.CartStatus.BorderColor3 = Color3.new(255,255,255)
  270. pgui.Main.CartStatus.Text = "1"
  271. end
  272. end
  273.  
  274. function onKeyDown(key)
  275. if key == "y" and Tool.Lamp.Light.Enabled == true then
  276. Tool.Lamp.Light.Enabled = false
  277. elseif key == "y" then
  278. Tool.Lamp.Light.Enabled = true
  279. end
  280. if key == "r" and not enabled then
  281. safety = true
  282. elseif key == "r" and cart then
  283. cart = false
  284. Tool.Cartr.Value = false
  285. Tool.Cart.Transparency = 1
  286. Tool.Cart.CanCollide = false
  287. Tool.CartPart1.Transparency = 1
  288. Tool.CartPart1.CanCollide = false
  289. Tool.CartPart2.Transparency = 1
  290. Tool.CartPart2.CanCollide = false
  291. Tool.BlastDoor1.Transparency = 1
  292. Tool.BlastDoor1.CanCollide = false
  293. Tool.BlastDoor2.Transparency = 1
  294. Tool.BlastDoor2.CanCollide = false
  295. if Tool.LineV.Value == true then
  296. target:FindFirstChild("strings"):remove()
  297. Tool.LineV.Value = false
  298. end
  299. elseif key == "r" then
  300. Tool.Cartr.Value = true
  301. Tool.Deployed.Value = false
  302. cart = true
  303. benabled = true
  304. target = nil
  305. Tool.Cart.Transparency = 0
  306. Tool.Cart.CanCollide = true
  307. Tool.CartPart1.Transparency = 0
  308. Tool.CartPart1.CanCollide = true
  309. Tool.CartPart2.Transparency = 0
  310. Tool.CartPart2.CanCollide = true
  311. Tool.BlastDoor1.Transparency = 0
  312. Tool.BlastDoor1.CanCollide = true
  313. Tool.BlastDoor2.Transparency = 0
  314. Tool.BlastDoor2.CanCollide = true
  315. if Tool.LineV.Value == true then
  316. target:FindFirstChild("strings"):remove()
  317. Tool.LineV.Value = false
  318. end
  319. end
  320. end
  321.  
  322. function onEquippedLocal(mouse)
  323.  
  324. if mouse == nil then
  325. print("Mouse not found")
  326. return
  327. end
  328.  
  329. local h = Tool.Parent:findFirstChild("Humanoid")
  330.  
  331. if h~=nil and game.Players:findFirstChild(h.Parent.Name)~=nil then
  332. local gui = Tool.Gui:clone()
  333. gui.Parent = game.Players:findFirstChild(h.Parent.Name).PlayerGui
  334. pgui = gui
  335.  
  336. UpdateDisplay()
  337.  
  338. Tool.TimerVal.Changed:connect(UpdateDisplay)
  339. Tool.Cartr.Changed:connect(UpdateDisplay)
  340. Tool.Deployed.Changed:connect(UpdateDisplay)
  341. end
  342.  
  343. mouse.Icon = "http://www.roblox.com/asset/?id=2966012"
  344. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  345. mouse.Button1Up:connect(function() onButton1Up(mouse)end)
  346. mouse.KeyDown:connect(onKeyDown)
  347. end
  348.  
  349.  
  350. Tool.Equipped:connect(onEquippedLocal)
  351.  
  352. function onUnequippedLocal()
  353. if Tool.LineV.Value == true then
  354. target:FindFirstChild("strings"):remove()
  355. Tool.LineV.Value = false
  356. end
  357.  
  358. if pgui ~= nil then
  359. pgui:Remove()
  360. pgui = nil
  361. end
  362. if target ~= nil then
  363. if target:findFirstChild("OverrideScript") ~= nil then target.OverrideScript:Remove() end
  364. end
  365. end
  366.  
  367. Tool.Unequipped:connect(onUnequippedLocal)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement