Advertisement
ethan15864

portal

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