Advertisement
iiWolfie

portal gun

Jul 6th, 2016
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. receiver = game.Players.LocalPlayer
  2. path = receiver.Backpack
  3.  
  4. t = Instance.new("Tool")
  5. t.GripForward = Vector3.new(-0, 0.000006, -1)
  6. t.GripPos = Vector3.new(0, -0.3, -0.5)
  7. t.GripRight = Vector3.new(1, 0, -0)
  8. t.GripUp = Vector3.new(0, 1, 0.000006)
  9. t.Name = "VI Portal gun"
  10. t.Enabled = true
  11. t.Parent = path
  12.  
  13. h = Instance.new("Part")
  14. h.BrickColor = BrickColor.White()
  15. h.Size = Vector3.new(1,1,2)
  16. h.Name = "Handle"
  17. h.Parent = t
  18.  
  19. s = Instance.new("Sound")
  20. s.SoundId = "rbxasset://sounds/bass.wav"
  21. s.Volume = 0.5
  22. s.Name = "failure"
  23. s.Parent = h
  24.  
  25. s = Instance.new("Sound")
  26. s.SoundId = "rbxasset://sounds/electronicpingshort.wav"
  27. s.Volume = 0.5
  28. s.Name = "fire"
  29. s.Parent = h
  30.  
  31. s = Instance.new("Script")
  32. s.Source = [[function tele(hit)
  33. if (script.Parent.Parent:findFirstChild("PortalB") ~= nil and hit.Parent:findFirstChild("Torso") ~= nil) then
  34. if (hit.Parent.Torso:findFirstChild("t") ~= nil) then return end
  35. hit.Parent.Torso.CFrame = CFrame.new(script.Parent.Parent.PortalB.Position)
  36. h = Instance.new("Humanoid")
  37. h.Name = "t"
  38. h.Parent = hit.Parent.Torso
  39. wait(0.5)
  40. h:remove()
  41. end
  42. end
  43.  
  44. script.Parent.Touched:connect(tele)
  45.  
  46. ]]
  47.  
  48. s.Disabled = true
  49. s.Name = "PortalScriptA"
  50. s.Parent = t
  51.  
  52. s = Instance.new("Script")
  53. s.Source = [[function tele(hit)
  54. if (script.Parent.Parent:findFirstChild("PortalA") ~= nil and hit.Parent:findFirstChild("Torso") ~= nil) then
  55. if (hit.Parent.Torso:findFirstChild("t") ~= nil) then return end
  56. hit.Parent.Torso.CFrame = CFrame.new(script.Parent.Parent.PortalA.Position)
  57. h = Instance.new("Humanoid")
  58. h.Name = "t"
  59. h.Parent = hit.Parent.Torso
  60. wait(0.5)
  61. h:remove()
  62. end
  63. end
  64.  
  65. script.Parent.Touched:connect(tele)
  66.  
  67. ]]
  68.  
  69. s.Disabled = true
  70. s.Name = "PortalScriptB"
  71. s.Parent = t
  72.  
  73.  
  74.  
  75. s = Instance.new("LocalScript")
  76. s.Source = [[local Tool = script.Parent;
  77.  
  78.  
  79.  
  80. enabled = true
  81.  
  82. function onButton1Down(mouse)
  83. targ = mouse.Target
  84. if (targ == nil) then return end
  85. if (targ.Name == "NoP") then
  86. script.Parent.Handle.failure:play()
  87. return
  88. end
  89.  
  90. Hit = mouse.hit
  91. if Hit==nil then return end
  92. I = Instance.new("Part")
  93. I.Parent = script.Parent.Parent
  94. I.CFrame = Hit
  95. I.Anchored = true
  96. I.CanCollide = false
  97. I.Shape = "Ball"
  98. I.Size = Vector3.new(4,4,4)
  99. I.Transparency = 0.5
  100. I.Reflectance = 0.1
  101. if (script.B.Value == true) then
  102. p = script.Parent.Parent:findFirstChild("PortalA")
  103. if (p ~= nil) then p:remove() end
  104. I.BrickColor = BrickColor.Blue()
  105. I.Name = "PortalA"
  106. s = script.Parent.PortalScriptA:clone()
  107. s.Disabled = false
  108. s.Parent = I
  109. else
  110. p = script.Parent.Parent:findFirstChild("PortalB")
  111. if (p ~= nil) then p:remove() end
  112. I.BrickColor = BrickColor.Red()
  113. I.Name = "PortalB"
  114. s = script.Parent.PortalScriptB:clone()
  115. s.Disabled = false
  116. s.Parent = I
  117. end
  118. script.B.Value = not script.B.Value
  119.  
  120. script.Parent.Handle.fire:play()
  121.  
  122. if not enabled then
  123.  
  124. return
  125.  
  126. end
  127.  
  128.  
  129.  
  130. enabled = false
  131.  
  132. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  133.  
  134.  
  135.  
  136. wait(.3)
  137.  
  138. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  139.  
  140. enabled = true
  141.  
  142.  
  143.  
  144. end
  145.  
  146.  
  147.  
  148. function onEquippedLocal(mouse)
  149.  
  150.  
  151.  
  152. if mouse == nil then
  153.  
  154. print("Mouse not found")
  155.  
  156. return
  157.  
  158. end
  159.  
  160.  
  161.  
  162. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  163.  
  164. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  165.  
  166. end
  167.  
  168.  
  169.  
  170.  
  171.  
  172. Tool.Equipped:connect(onEquippedLocal)
  173.  
  174.  
  175. ]]
  176.  
  177. v = Instance.new("BoolValue")
  178. v.Value = false
  179. v.Name = "B"
  180. v.Parent = s
  181.  
  182. s.Name = "Local Gui"
  183. s.Parent = t
  184.  
  185.  
  186. --Removing this message or editing it's content is punishable by law.
  187.  
  188. msg = Instance.new("Message")
  189. msg.Text = "VolcanoINC's portal gun loaded for " .. receiver.Name
  190. msg.Parent = game.Workspace
  191. wait(3)
  192. msg.Parent = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement