Advertisement
Legendofawesomeness3

Mini Trap

Jul 5th, 2016
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. --Mine Trap Gifted by TheRedAngel, Regular Script!
  2.  
  3. me = game.Players.LegendOfAwesomeness3
  4. char = me.Character
  5. place = 1
  6. trapdist = 10
  7. modes = {"jail","trap"}
  8. mode = modes[place]
  9.  
  10. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  11. part.Parent = parent
  12. part.formFactor = form
  13. part.CanCollide = collide
  14. part.Transparency = tran
  15. part.Reflectance = ref
  16. part.Size = Vector3.new(x,y,z)
  17. part.BrickColor = BrickColor.new(color)
  18. part.TopSurface = 0
  19. part.BottomSurface = 0
  20. part.Anchored = anchor
  21. part.Locked = true
  22. part:BreakJoints()
  23. end
  24.  
  25. function gettorsos(path,object)
  26. local torsos = {}
  27. for _,v in pairs(path:children()) do
  28. for _,k in pairs(v:children()) do
  29. if k.Parent:findFirstChild("Humanoid") ~= nil and k.Name == "Torso" then
  30. if (k.Position - object.Position).magnitude < trapdist then
  31. table.insert(torsos,k)
  32. end
  33. end
  34. end
  35. end
  36. return torsos
  37. end
  38.  
  39. trail = Instance.new("Part")
  40. prop(trail,nil,false,0.4,0.05,0.3,0.3,1,"Bright red",true,"Custom")
  41. trailmesh = Instance.new("BlockMesh",trail)
  42.  
  43. point = Instance.new("Part")
  44. prop(point,nil,false,0.3,0.05,1.2,0.3,1.2,"Bright violet",true,"Custom")
  45. local pm = Instance.new("SpecialMesh",point)
  46. pm.MeshType = "Sphere"
  47.  
  48. function jail(pos)
  49. local cf = CFrame.new(pos) * CFrame.new(0,3,0) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
  50. local mod = Instance.new("Model",workspace)
  51. mod.Name = "Jail, xS"
  52. for i=1, 360, 90 do
  53. local p = Instance.new("Part")
  54. prop(p,mod,true,1,0.1,11,11,0.2,"Bright blue",true,"Custom")
  55. p.CFrame = cf * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-5.5)
  56. p.Name = "Window"
  57. end
  58. local lol = cf * CFrame.Angles(0,math.rad(90),0)
  59. for i=0, 180, 180 do
  60. local p = Instance.new("Part")
  61. prop(p,mod,true,1,0.1,11,11,0.2,"Bright blue",true,"Custom")
  62. p.CFrame = lol * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-5.5)
  63. p.Name = "Window"
  64. end
  65. for i=1, 360, 90 do
  66. local p = Instance.new("Part")
  67. prop(p,mod,true,1,0.1,1.5,12.5,1.5,"Medium grey",true,"Custom")
  68. p.CFrame = cf * CFrame.Angles(math.rad(i),0,0) * CFrame.new(-5.5,0,-5.5)
  69. local o = Instance.new("Part")
  70. prop(o,mod,true,1,0.1,1.5,12.5,1.5,"Medium grey",true,"Custom")
  71. o.CFrame = cf * CFrame.Angles(math.rad(i),0,0) * CFrame.new(5.5,0,-5.5)
  72. end
  73. for i=0, 180, 180 do
  74. local p = Instance.new("Part")
  75. prop(p,mod,true,1,0.1,1.5,1.5,12.5,"Medium grey",true,"Custom")
  76. p.CFrame = lol * CFrame.Angles(math.rad(i),0,0) * CFrame.new(-5.5,-5.5,0)
  77. local o = Instance.new("Part")
  78. prop(o,mod,true,1,0.1,1.5,1.5,12.5,"Medium grey",true,"Custom")
  79. o.CFrame = lol * CFrame.Angles(math.rad(i),0,0) * CFrame.new(5.5,5.5,0)
  80. end
  81. for _,v in pairs(mod:children()) do
  82. coroutine.resume(coroutine.create(function()
  83. for i=1, 0, -0.05 do
  84. wait()
  85. if v.Name == "Window" then
  86. v.Transparency = i + 0.4
  87. else
  88. v.Transparency = i
  89. end
  90. end
  91. end))
  92. wait()
  93. end
  94. end
  95.  
  96. function trap(pos)
  97. local mod = Instance.new("Model",workspace)
  98. mod.Name = "Trap, xS"
  99. local y = 0.3
  100. for i=12.5,6,-1.5 do
  101. local p = Instance.new("Part")
  102. prop(p,mod,true,1,0.06,i,1,i,"Black",true,"Custom")
  103. p.CFrame = CFrame.new(pos) * CFrame.new(0,y,0)
  104. Instance.new("CylinderMesh",p)
  105. y = y + i/30
  106. end
  107. local p = Instance.new("Part")
  108. prop(p,mod,true,1,0.1,5,0.2,5,"Lime green",true,"Custom")
  109. p.CFrame = CFrame.new(pos) * CFrame.new(0,y+0.2,0)
  110. Instance.new("CylinderMesh",p)
  111. local trapped = false
  112. coroutine.resume(coroutine.create(function()
  113. while mod.Parent ~= nil do
  114. local objs = gettorsos(workspace,p)
  115. if trapped then break end
  116. for _,v in pairs(objs) do
  117. if trapped then break end
  118. trapped = true
  119. local bp = Instance.new("BodyPosition",v)
  120. bp.position = p.Position + Vector3.new(0,6,0)
  121. bp.P = 6000
  122. bp.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  123. local bav = Instance.new("BodyAngularVelocity",v)
  124. bav.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  125. bav.P = 7000
  126. bav.angularvelocity = Vector3.new(0,30,0)
  127. local o = Instance.new("Part")
  128. prop(o,mod,false,0.6,0.1,1,1,1,"Lime green",true,"Custom")
  129. local mo = Instance.new("SpecialMesh",o)
  130. mo.MeshType = "Sphere"
  131. mo.Scale = Vector3.new(5.2,8,5.2)
  132. o.CFrame = p.CFrame * CFrame.new(0,-5,0)
  133. for i=-5,6,0.25 do
  134. wait()
  135. o.CFrame = p.CFrame * CFrame.new(0,i,0)
  136. end
  137. wait(5)
  138. local ex = Instance.new("Explosion",mod)
  139. ex.BlastRadius = 2
  140. ex.BlastPressure = 50000
  141. ex.Position = v.Position
  142. ex.Hit:connect(function(p)
  143. p:breakJoints()
  144. end)
  145. o:remove()
  146. for _,j in pairs(mod:children()) do
  147. coroutine.resume(coroutine.create(function()
  148. for i=0, 1, 0.1 do
  149. wait()
  150. j.Transparency = i
  151. end
  152. j:remove()
  153. end))
  154. wait(0.04)
  155. end
  156. mod:remove()
  157. bav:remove()
  158. bp:remove()
  159. end
  160. wait(0.08)
  161. end
  162. end))
  163. for _,v in pairs(mod:children()) do
  164. coroutine.resume(coroutine.create(function()
  165. for i=1, 0, -0.05 do
  166. wait()
  167. v.Transparency = i
  168. end
  169. v.Transparency = 0
  170. end))
  171. wait()
  172. end
  173. end
  174.  
  175. if script.Parent.className ~= "HopperBin" then
  176. h = Instance.new("HopperBin",me.Backpack)
  177. h.Name = "Lol?"
  178. script.Parent = h
  179. end
  180.  
  181. bin = script.Parent
  182. sel = false
  183.  
  184. bin.Selected:connect(function(mouse)
  185. sel = true
  186. trail.Parent = char
  187. point.Parent = char
  188. coroutine.resume(coroutine.create(function()
  189. while sel do
  190. local dis = (me.Character.Torso.Position - mouse.Hit.p).magnitude
  191. trailmesh.Scale = Vector3.new(1,1,dis)
  192. trail.CFrame = CFrame.new(me.Character.Torso.Position, mouse.Hit.p) * CFrame.new(0,0,-dis/2)
  193. point.CFrame = CFrame.new(mouse.Hit.p)
  194. wait()
  195. end
  196. end))
  197. mouse.Button1Down:connect(function()
  198. if mode == "jail" then
  199. jail(mouse.Hit.p)
  200. elseif mode == "trap" then
  201. trap(mouse.Hit.p)
  202. end
  203. for i=0.3,1,0.1 do
  204. pm.Scale = pm.Scale + Vector3.new(0.6,4,0.6)
  205. point.Transparency = i
  206. wait()
  207. end
  208. point.Transparency = 0.3
  209. pm.Scale = Vector3.new(1,1,1)
  210. end)
  211. mouse.KeyDown:connect(function(key)
  212. key = key:lower()
  213. if key == "q" then
  214. place = place - 1
  215. if place < 1 then
  216. place = #modes
  217. end
  218. mode = modes[place]
  219. elseif key == "e" then
  220. place = place + 1
  221. if place > #modes then
  222. place = 1
  223. end
  224. mode = modes[place]
  225. end
  226. end)
  227. end)
  228.  
  229. bin.Deselected:connect(function()
  230. sel = false
  231. trail.Parent = nil
  232. point.Parent = nil
  233. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement