Advertisement
Overhaleren

Portal Tool

May 23rd, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. me = game.Players.LocalPlayer
  2.  
  3. if script.Parent.className ~= "HopperBin" then
  4. h = Instance.new("HopperBin",me.Backpack)
  5. h.Name = "Portal"
  6. script.Parent = h
  7. end
  8.  
  9. bin = h
  10. mode = true
  11. hold = false
  12.  
  13. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  14. part.Parent = parent
  15. part.formFactor = form
  16. part.CanCollide = collide
  17. part.Transparency = tran
  18. part.Reflectance = ref
  19. part.Size = Vector3.new(x,y,z)
  20. part.BrickColor = BrickColor.new(color)
  21. part.TopSurface = 0
  22. part.BottomSurface = 0
  23. part.Anchored = anchor
  24. part:BreakJoints()
  25. end
  26.  
  27. function weld(w, p, p0, p1, a, b, c, x, y, z)
  28. w.Parent = p
  29. w.Part0 = p0
  30. w.Part1 = p1
  31. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  32. end
  33.  
  34. function mesh(mesh, parent, x, y, z, type)
  35. mesh.Parent = parent
  36. mesh.Scale = Vector3.new(x, y, z)
  37. mesh.MeshType = type
  38. end
  39.  
  40. out = false
  41. inn = false
  42.  
  43. function sel(mouse)
  44. local mk = nil
  45. local km = nil
  46. mouse.Button1Down:connect(function()
  47. if mode then
  48. if inn == false then
  49. inn = true
  50. mode = false
  51. hold = true
  52. local holdpos = mouse.Hit.p + Vector3.new(0,4,0)
  53. local portal = Instance.new("Model",workspace)
  54. portal.Name = "InPortal"
  55. local main = Instance.new("Part")
  56. prop(main, portal, false, 0.1, 0.1, 2.4, 2.4, 0.6, "Medium blue", true, "Custom")
  57. main.CFrame = CFrame.new(holdpos,mouse.Hit.p) * CFrame.new(0,3,0)
  58. local mes = Instance.new("SpecialMesh")
  59. mesh(mes,main,7,7,4,"FileMesh")
  60. mes.MeshId = "http://www.roblox.com/asset/?id=3270017"
  61. local f = Instance.new("Fire",main)
  62. f.Size = 7
  63. f.Heat = 0
  64. f.Color = Color3.new(0.1,0.2,1)
  65. f.SecondaryColor = Color3.new(0.4,0.4,0.6)
  66. while hold do
  67. wait()
  68. main.CFrame = CFrame.new(holdpos,mouse.Hit.p)
  69. end
  70. mk = main
  71. end
  72. else
  73. if inn == true and out == false then
  74. out = true
  75. mode = true
  76. hold = true
  77. local holdpos = mouse.Hit.p + Vector3.new(0,4,0)
  78. local portal = Instance.new("Model",workspace)
  79. portal.Name = "OutPortal"
  80. local main = Instance.new("Part")
  81. prop(main, portal, false, 0.1, 0.1, 2.4, 2.4, 0.6, "Neon orange", true, "Custom")
  82. main.CFrame = CFrame.new(holdpos,mouse.Hit.p) * CFrame.new(0,3,0)
  83. local mes = Instance.new("SpecialMesh")
  84. mesh(mes,main,7,7,4,"FileMesh")
  85. mes.MeshId = "http://www.roblox.com/asset/?id=3270017"
  86. local f = Instance.new("Fire",main)
  87. f.Size = 7
  88. f.Heat = 0
  89. f.Color = Color3.new(1,0.2,0.1)
  90. f.SecondaryColor = Color3.new(0.8,0.1,0.08)
  91. km = main
  92. hold = true
  93. while hold do
  94. wait()
  95. main.CFrame = CFrame.new(holdpos,mouse.Hit.p)
  96. end
  97. local tuch = true
  98. mk.Touched:connect(function(hit)
  99. local pla = game.Players:findFirstChild(hit.Parent.Name)
  100. if pla then
  101. if tuch then
  102. tuch = false
  103. local ff = Instance.new("Part")
  104. prop(ff,me.Character,false,1,0.2,2.3,2.3,1,"Medium blue",true,"Custom")
  105. local mag = (mk.Position - main.Position).magnitude
  106. ff.Size = Vector3.new(2.3,2.3,1)
  107. ff.CFrame = CFrame.new(mk.Position, main.Position) * CFrame.new(0,0,-mag/2)
  108. local mee = Instance.new("SpecialMesh",ff)
  109. mee.MeshType = "Brick"
  110. mee.Scale = Vector3.new(0.65,0.65,mag)
  111. for i=0.1, 1.1, 0.05 do
  112. mk.Transparency = i
  113. ff.Transparency = ff.Transparency - 0.04
  114. mee.Scale = Vector3.new(math.random(5,130)/100,math.random(5,130)/100,mag)
  115. wait()
  116. end
  117. pla.Character.Torso.CFrame = main.CFrame * CFrame.new(0,0,-3)
  118. for i=0.1,1.1,0.05 do
  119. main.Transparency = i
  120. ff.Transparency = ff.Transparency + 0.08
  121. mee.Scale = Vector3.new(math.random(30,120)/100,math.random(30,120)/100,mag)
  122. wait()
  123. end
  124. ff:remove()
  125. main:remove()
  126. mk:remove()
  127. mk = nil
  128. inn = false
  129. out = false
  130. end
  131. end
  132. end)
  133. end
  134. end
  135. end)
  136. mouse.Button1Up:connect(function()
  137. hold = false
  138. end)
  139. mouse.KeyDown:connect(function(key)
  140. key = key:lower()
  141. if (key == "q") then
  142. mode = true
  143. if mk ~= nil then
  144. mk:remove()
  145. mk = nil
  146. inn = false
  147. end
  148. if km ~= nil then
  149. km:remove()
  150. km = nil
  151. out = false
  152. end
  153. end
  154. end)
  155. end
  156.  
  157. bin.Selected:connect(sel)
  158.  
  159. --mediafire
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement