Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
5,796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.50 KB | None | 0 0
  1. mouse = game.Players.LocalPlayer:GetMouse()
  2. gun = Instance.new("Part", game.Players.LocalPlayer.Character)
  3. gun.Size = Vector3.new(0.5, 1, 2)
  4. gun.CanCollide = false
  5. gun:BreakJoints()
  6. weld = Instance.new("Weld", gun)
  7. weld.Part0 = game.Players.LocalPlayer.Character["Right Arm"]
  8. weld.Part1 = gun
  9. mesh = Instance.new("SpecialMesh", gun)
  10. mesh.MeshId = "rbxassetid://430056568"
  11. mesh.TextureId = "rbxassetid://430056584"
  12. portalmoosic = Instance.new("Sound", game.Players.LocalPlayer.Character)
  13. portalmoosic.SoundId = "rbxassetid://142300248"
  14. portalmoosic.Looped = true
  15. portalmoosic:Play()
  16. impact = Instance.new("Sound", game.Players.LocalPlayer.Character)
  17. impact.SoundId = "rbxassetid://142082170"
  18. mesh.Scale = Vector3.new(0.17,0.17,0.17)
  19. weld.C0 = weld.C0 * CFrame.new(-0.2,-1.3,-0.8) * CFrame.Angles(3,0,0)
  20. local rhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
  21. rhandweld.Part0 = game.Players.LocalPlayer.Character.Torso
  22. rhandweld.Part1 = game.Players.LocalPlayer.Character["Right Arm"]
  23. rhandweld.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  24. rhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  25. local lhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
  26. lhandweld.Part0 = game.Players.LocalPlayer.Character.Torso
  27. lhandweld.Part1 = game.Players.LocalPlayer.Character["Left Arm"]
  28. lhandweld.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  29. lhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  30. Pick = Instance.new("Sound", gun)
  31. Pick.SoundId = "rbxassetid://291256829"
  32. Pick:Play()
  33. Shoot = Instance.new("Sound", gun)
  34. Shoot.SoundId = "rbxassetid://142774034"
  35. blueexists = false
  36. tping = false
  37. orangeexists = false
  38. for i = 0,1 , 0.1 do
  39. wait()
  40. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,-0.2,-0.28),i)
  41. rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.28),i)
  42. end
  43. for i = 0,1 , 0.1 do
  44. wait()
  45. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.new(0,-0.25,0),i)
  46. end
  47. using = false
  48. orange = false
  49. blue = true
  50. function changeportals(key)
  51. key = key:lower()
  52. if key == "q" then
  53. if not blue then
  54. blue = true
  55. orange = false
  56. end
  57. end
  58. if key == "e" then
  59. if not orange then
  60. blue = false
  61. orange = true
  62. end
  63. end
  64. end
  65. function portal()
  66. if not using then
  67. using = true
  68. if blue then
  69. Shoot:Play()
  70. local projectile = Instance.new("Part", workspace)
  71. projectile.Size = Vector3.new(1,1,1)
  72. projectile.BrickColor = BrickColor.new("Electric blue")
  73. projectile.Shape = "Ball"
  74. projectile.CanCollide = true
  75. projectile.Anchored = false
  76. projectile.Material = "Neon"
  77. local vel = Instance.new("BodyVelocity", projectile)
  78. vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  79. vel.Velocity = mouse.Hit.lookVector * 80
  80. projectile.Position = gun.CFrame.p
  81. wait(0.03)
  82. local function make(part)
  83. local gr = part.Parent:findFirstChild("Part")
  84. local porjectileposition = projectile.Position
  85. local portaldoor = Instance.new("Part", workspace)
  86. portaldoor.Size = Vector3.new(1, 1, 1)
  87. portaldoor.BrickColor = BrickColor.new("Electric blue")
  88. portaldoor.Anchored = true
  89. portaldoor.Shape = "Cylinder"
  90. portaldoor.Material = "Neon"
  91. portaldoor.CanCollide = false
  92. if blueexists == true then
  93. workspace.BluePortal:destroy()
  94. end
  95. blueexists = true
  96. portaldoor.Name = "BluePortal"
  97. portaldoor.CFrame = part.CFrame
  98. if part.Size.y < part.Size.x and part.Size.y < part.Size.z then --a big help from Toxsikkilla
  99. print("if y < x")
  100. portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.pi / 2)
  101. elseif part.Size.x < part.Size.y and part.Size.x < part.Size.z then
  102. print("if x < y")
  103. portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
  104. elseif part.Size.z < part.Size.y and part.Size.z < part.Size.y then
  105. print("if z < y")
  106. portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi / 2, 0)
  107. end
  108. portaldoor.Position = projectile.Position
  109. projectile:destroy()
  110. for i = 1,18 do
  111. portaldoor.Size = portaldoor.Size + Vector3.new(0,0.3,0.3)
  112. wait()
  113. end
  114. local function tp(part)
  115. local hum = part.Parent:findFirstChild("Humanoid")
  116. if hum ~= nil and blueexists and orangeexists and not tping then
  117. tping = true
  118. local tor = part.Parent:findFirstChild("Torso")
  119. if tor then
  120. local velocityoftorso = tor.Velocity
  121. local blport = workspace:findFirstChild("OrangePortal")
  122. if blport then
  123. tor.CFrame = workspace.OrangePortal.CFrame
  124. tor.Velocity = workspace.OrangePortal.CFrame.rightVector * -velocityoftorso * 1.7
  125. end
  126. end
  127. wait(0.3)
  128. tping = false
  129. end
  130. if not hum and blueexists and orangeexists and not tping then
  131. tping = true
  132. local cube = part.Parent:findFirstChild("Cube")
  133. if cube then
  134. tping = true
  135. local velocityoftorso = cube.Velocity
  136. cube.CFrame = workspace.OrangePortal.CFrame
  137. cube.Velocity = workspace.OrangePortal.CFrame.rightVector * -velocityoftorso * 1.7
  138. wait(0.3)
  139. tping = false
  140. end
  141. end
  142. wait(0.3)
  143. tping = false
  144. end
  145. portaldoor.Touched:connect(tp)
  146. end
  147. projectile.Touched:connect(make)
  148. end
  149. if orange then
  150. Shoot:Play()
  151. local projectile1 = Instance.new("Part", workspace)
  152. projectile1.Size = Vector3.new(1,1,1)
  153. projectile1.BrickColor = BrickColor.new("Deep orange")
  154. projectile1.Shape = "Ball"
  155. projectile1.CanCollide = true
  156. projectile1.Anchored = false
  157. projectile1.Material = "Neon"
  158. local vel1 = Instance.new("BodyVelocity", projectile1)
  159. vel1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  160. vel1.Velocity = mouse.Hit.lookVector * 80
  161. projectile1.Position = gun.CFrame.p
  162. wait(0.03)
  163. local function make1(part)
  164. local gr = part.Parent:findFirstChild("Part")
  165. local portaldoor = Instance.new("Part", workspace)
  166. portaldoor.Size = Vector3.new(1, 1, 1)
  167. portaldoor.BrickColor = BrickColor.new("Deep orange")
  168. portaldoor.Anchored = true
  169. portaldoor.Material = "Neon"
  170. portaldoor.Shape = "Cylinder"
  171. portaldoor.CanCollide = false
  172. if orangeexists == true then
  173. workspace.OrangePortal:destroy()
  174. end
  175. portaldoor.CFrame = part.CFrame
  176. if part.Size.y < part.Size.x and part.Size.y < part.Size.z then --a big help from Toxsikkilla
  177. print("if y < x")
  178. portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.pi / 2)
  179. elseif part.Size.x < part.Size.y and part.Size.x < part.Size.z then
  180. print("if x < y")
  181. portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
  182. elseif part.Size.z < part.Size.y and part.Size.z < part.Size.y then
  183. print("if z < y")
  184. portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi / 2, 0)
  185. end
  186. portaldoor.Position = projectile1.Position
  187. projectile1:destroy()
  188. for i = 1,18 do
  189. portaldoor.Size = portaldoor.Size + Vector3.new(0,0.3,0.3)
  190. wait()
  191. end
  192. orangeexists = true
  193. portaldoor.Name = "OrangePortal"
  194. local function tp(part)
  195. local hum = part.Parent:findFirstChild("Humanoid")
  196. if hum ~= nil and blueexists and orangeexists and not tping then
  197. tping = true
  198. local tor = part.Parent:findFirstChild("Torso")
  199. if tor then
  200. local velocityoftorso = tor.Velocity
  201. local blport = workspace:findFirstChild("BluePortal")
  202. if blport then
  203. tor.CFrame = workspace.BluePortal.CFrame
  204. tor.Velocity = workspace.BluePortal.CFrame.rightVector * -velocityoftorso * 1.7
  205. end
  206. end
  207. wait(0.3)
  208. tping = false
  209. end
  210. if not hum and blueexists and orangeexists and not tping then
  211. tping = true
  212. local cube = part.Parent:findFirstChild("Cube")
  213. if cube then
  214. tping = true
  215. local velocityoftorso = cube.Velocity
  216. local blport = workspace:findFirstChild("BluePortal")
  217. if velocityoftorso.y < velocityoftorso.z and velocityoftorso.y < velocityoftorso.x then
  218. cube.Velocity = -velocityoftorso * 1.5
  219. if blport then
  220. cube.CFrame = workspace.BluePortal.rightVector * -velocityoftorso * 1.7
  221. end
  222. end
  223. wait(0.3)
  224. tping = false
  225. end
  226. wait(0.3)
  227. tping = false
  228. end
  229. wait(0.3)
  230. tping = false
  231. end
  232. portaldoor.Touched:connect(tp)
  233. end
  234. projectile1.Touched:connect(make1)
  235. end
  236.  
  237. for i = 0,1 , 0.3 do
  238. wait()
  239. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
  240. rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
  241. end
  242. for i = 0,1 , 0.3 do
  243. wait()
  244. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
  245. rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
  246. end
  247. using = false
  248. end
  249. end
  250. function remove(key)
  251. key = key:lower()
  252. if key == "r" then
  253. if blueexists or orangeexists or blueexists and orangeexists then
  254. workspace.OrangePortal:destroy()
  255. workspace.BluePortal:destroy()
  256. orangeexists = false
  257. blueexists = false
  258. end
  259. end
  260. end
  261. impacting = false
  262. cubesp = false
  263. function cubespawn(key)
  264. key = key:lower()
  265. if key == "c" then
  266. if cubesp then
  267. workspace.Cube:destroy()
  268. end
  269. cubesp = true
  270. local coobe = Instance.new("Part", workspace)
  271. coobe.Size = Vector3.new(2.774, 2.834, 2.804)
  272. coobe:BreakJoints()
  273. coobe.Position = game.Players.LocalPlayer.Character.Torso.Position
  274. coobe.Name = "Cube"
  275. local meh = Instance.new("SpecialMesh", coobe)
  276. meh.MeshId = "rbxassetid://464957313"
  277. meh.TextureId = "rbxassetid://464957325"
  278. meh.Scale = Vector3.new(0.8,0.8,0.8)
  279. local function sounds()
  280. if not impacting then
  281. impacting = true
  282. local impactspeed = math.random(0.9,1.1)
  283. impact.PlaybackSpeed = impactspeed
  284. impact:Play()
  285. wait(0.2)
  286. impacting = false
  287. end
  288. end
  289. coobe.Touched:connect(sounds)
  290. end
  291. end
  292. function deleterportalsondedth()
  293. if orangeexists or blueexists or blueexists and orangeexists then
  294. workspace.OrangePortal:destroy()
  295. workspace.BluePortal:destroy()
  296. if cubesp then
  297. workspace.Cube:destroy()
  298. end
  299. end
  300. end
  301. game.Players.LocalPlayer.Character.Humanoid.Died:connect(deleterportalsondedth)
  302. mouse.KeyDown:connect(cubespawn)
  303. mouse.Button1Down:connect(portal)
  304. mouse.KeyDown:connect(changeportals)
  305. mouse.KeyDown:connect(remove)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement