Advertisement
Godofadmin1337

Time bomb thing

Nov 6th, 2017
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.03 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. SpecialMesh2 = Instance.new("SpecialMesh")
  22. LocalScript3 = Instance.new("LocalScript")
  23. Script4 = Instance.new("Script")
  24. Script5 = Instance.new("Script")
  25. Tool0.Name = "SubspaceTripmine"
  26. Tool0.Parent = mas
  27. Tool0.TextureId = "http://www.roblox.com/asset/?id=11987521"
  28. Tool0.GripForward = Vector3.new(1, -0, -0)
  29. Tool0.GripPos = Vector3.new(-0.5, 0, 0)
  30. Tool0.GripRight = Vector3.new(0, -0, 1)
  31. Part1.Name = "Handle"
  32. Part1.Parent = Tool0
  33. Part1.BrickColor = BrickColor.new("Hot pink")
  34. Part1.Rotation = Vector3.new(0, -74.1500015, -0.049999997)
  35. Part1.RotVelocity = Vector3.new(1, 1, 1)
  36. Part1.FormFactor = Enum.FormFactor.Symmetric
  37. Part1.Size = Vector3.new(2, 2, 2)
  38. Part1.CFrame = CFrame.new(50.7512131, 234.194107, 355.285461, 0.273154944, 0.000219101086, -0.961969852, -0.000797369401, 0.999999642, 1.34684103e-06, 0.961969614, 0.000766677491, 0.273155004)
  39. Part1.BottomSurface = Enum.SurfaceType.Smooth
  40. Part1.TopSurface = Enum.SurfaceType.Smooth
  41. Part1.Color = Color3.new(1, 0, 0.74902)
  42. Part1.Position = Vector3.new(50.7512131, 234.194107, 355.285461)
  43. Part1.Orientation = Vector3.new(0, -74.1500015, -0.049999997)
  44. Part1.Color = Color3.new(1, 0, 0.74902)
  45. SpecialMesh2.Parent = Part1
  46. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=11954776"
  47. SpecialMesh2.Scale = Vector3.new(0.699999988, 0.699999988, 0.699999988)
  48. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=11954766"
  49. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  50. SpecialMesh2.Scale = Vector3.new(0.699999988, 0.699999988, 0.699999988)
  51. LocalScript3.Name = "Local Gui"
  52. LocalScript3.Parent = Tool0
  53. table.insert(cors,sandbox(LocalScript3,function()
  54. local Tool = script.Parent;
  55.  
  56. enabled = true
  57. function onButton1Down(mouse)
  58. if not enabled then
  59. return
  60. end
  61.  
  62. enabled = false
  63. mouse.Icon = "rbxasset://textures\\ArrowFarCursor.png"
  64.  
  65. wait(3)
  66. mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
  67. enabled = true
  68.  
  69. end
  70.  
  71. function onEquippedLocal(mouse)
  72.  
  73. if mouse == nil then
  74. print("Mouse not found")
  75. return
  76. end
  77.  
  78. mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
  79. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  80. end
  81.  
  82. Tool.Equipped:connect(onEquippedLocal)
  83.  
  84. end))
  85. Script4.Name = "PlantBomb"
  86. Script4.Parent = Tool0
  87. table.insert(cors,sandbox(Script4,function()
  88. bombScript = script.Parent.SubspaceMine
  89. Tool = script.Parent
  90.  
  91. function plant(pos)
  92.  
  93.  
  94. local vCharacter = Tool.Parent
  95. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  96.  
  97. local spawnPos = vCharacter.PrimaryPart.Position
  98.  
  99.  
  100. local bomb = Tool.Handle:Clone()
  101. bomb.CanCollide = true
  102. bomb.Transparency = 0
  103. bomb.Position = pos
  104. bomb.Size = Vector3.new(2,2,2)
  105. bomb.Name = "SubspaceTripmine"
  106. bomb.Locked = true
  107.  
  108.  
  109. local creator_tag = Instance.new("ObjectValue")
  110. creator_tag.Value = vPlayer
  111. creator_tag.Name = "creator"
  112. creator_tag.Parent = bomb
  113.  
  114. bomb.Parent = game.Workspace
  115. local new_script = bombScript:clone()
  116. new_script.Disabled = false
  117. new_script.Parent = bomb
  118.  
  119. end
  120.  
  121.  
  122. Tool.Enabled = true
  123. function onActivated()
  124.  
  125. if not Tool.Enabled then
  126. return
  127. end
  128.  
  129. Tool.Enabled = false
  130.  
  131. local character = Tool.Parent;
  132. local humanoid = character.Humanoid
  133. if humanoid == nil then
  134. print("Humanoid not found")
  135. return
  136. end
  137.  
  138. local targetPos = humanoid.TargetPoint
  139.  
  140. Tool.Handle.Transparency = 1
  141. plant(Tool.Handle.Position)
  142. wait(0)
  143. Tool.Handle.Transparency = 0
  144.  
  145. Tool.Enabled = true
  146. end
  147.  
  148.  
  149. script.Parent.Activated:connect(onActivated)
  150. end))
  151. Script5.Name = "SubspaceMine"
  152. Script5.Parent = Tool0
  153. Script5.Disabled = true
  154. table.insert(cors,sandbox(Script5,function()
  155. Mine = script.Parent
  156.  
  157. DunDun = Instance.new("Sound")
  158. DunDun.SoundId = "http://www.roblox.com/asset/?id=11984254"
  159. DunDun.Parent = Mine
  160.  
  161. SubspaceExplosion = Instance.new("Sound")
  162. SubspaceExplosion.SoundId = "http://www.roblox.com/asset/?id=141679994"
  163. SubspaceExplosion.Parent = Mine
  164.  
  165. Calibrate = Instance.new("Sound")
  166. Calibrate.SoundId = "http://www.roblox.com/asset/?id=161164363"
  167. Calibrate.Looped = true
  168. Calibrate.Parent = Mine
  169. Calibrate:Play()
  170.  
  171. local calibration_time = 2 -- needs to be still/untouched for this long before calibrating
  172. local cur_time = 0
  173. local max_life = 120 -- these things last for 2 minutes on their own, once activated
  174. local calibrated = false
  175.  
  176. local connection = nil
  177.  
  178. function activateMine()
  179. for i=0,1,.1 do
  180. Mine.Transparency = i
  181. wait(.05)
  182. end
  183. calibrated = true
  184. Calibrate:Stop()
  185. end
  186.  
  187. function pulse()
  188. DunDun:Play()
  189.  
  190. for i=.9,.5,-.1 do
  191. Mine.Transparency = i
  192. wait(.05)
  193. end
  194.  
  195. for i=.5,1,.1 do
  196. Mine.Transparency = i
  197. wait(.05)
  198. end
  199. end
  200.  
  201. function explode()
  202. connection:disconnect()
  203.  
  204. for i=1,0,-.2 do
  205. Mine.Transparency = i
  206. wait(.05)
  207. end
  208. SubspaceExplosion:Play()
  209.  
  210. local e = Instance.new("Explosion")
  211. e.BlastRadius = 500
  212. e.BlastPressure = 1000000
  213. e.Position = Mine.Position
  214. e.Parent = Mine
  215.  
  216. local creator = script.Parent:findFirstChild("creator")
  217.  
  218. e.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end)
  219.  
  220.  
  221. for i=0,1,.2 do
  222. Mine.Transparency = i
  223. wait(.05)
  224. end
  225. wait(4)
  226. Mine:Remove()
  227. end
  228.  
  229. function update()
  230. if (calibrated == false) then
  231. if (Mine.Velocity.magnitude > .05) then
  232. cur_time = 0
  233. end
  234.  
  235. if (cur_time > calibration_time) then
  236. activateMine()
  237. end
  238. else
  239. -- calibrated mine
  240. if (math.random(1,20) == 2) then
  241. pulse()
  242. end
  243.  
  244. if (cur_time > max_life) then pulse() Mine:Remove() end
  245. end
  246. end
  247.  
  248.  
  249. function OnTouch(part)
  250. if (calibrated == false) then
  251. cur_time = 0
  252. else
  253. explode()
  254. end
  255. end
  256.  
  257.  
  258. function onPlayerBlownUp(part, distance, creator)
  259.  
  260. if (part:getMass() < 300) then
  261. part.BrickColor = BrickColor.new(1032)
  262. local s = Instance.new("Sparkles")
  263. s.Parent = part
  264. game.Debris:AddItem(s, 5)
  265. end
  266.  
  267.  
  268. if creator ~= nil and part.Name == "Head" then
  269. local humanoid = part.Parent.Humanoid
  270. tagHumanoid(humanoid, creator)
  271. end
  272. end
  273.  
  274. function tagHumanoid(humanoid, creator)
  275. -- tag does not need to expire iff all explosions lethal
  276.  
  277. if creator ~= nil then
  278. local new_tag = creator:clone()
  279. new_tag.Parent = humanoid
  280. end
  281. end
  282.  
  283. function untagHumanoid(humanoid)
  284. if humanoid ~= nil then
  285. local tag = humanoid:findFirstChild("creator")
  286. if tag ~= nil then
  287. tag.Parent = nil
  288. end
  289. end
  290. end
  291.  
  292. connection = Mine.Touched:connect(OnTouch)
  293.  
  294.  
  295. while true do
  296. update()
  297. local e,g = wait(.5)
  298. cur_time = cur_time + e
  299. end
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306. end))
  307. for i,v in pairs(mas:GetChildren()) do
  308. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  309. pcall(function() v:MakeJoints() end)
  310. end
  311. mas:Destroy()
  312. for i,v in pairs(cors) do
  313. spawn(function()
  314. pcall(v)
  315. end)
  316. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement