Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.31 KB | None | 0 0
  1. -- Portal Gun by Theamazingnater
  2. plr = game.Players.LocalPlayer
  3. repeat wait() until plr.Character
  4. char = plr.Character
  5.  
  6.  
  7. print("By Theamazingnater")
  8. print("Portal Gun Controls:" .. [[
  9.  
  10. Left Mouse Button = Shoot Blue Portal
  11. E = Shoot Orange Portal
  12. T = Clear All Portals
  13. Y = Quotes from Glados
  14. F = Wall Mode (allows you to place portals on walls)
  15. G = Floor Mode (activated by default)
  16. H = Subtitles On
  17. J = Subtitles Off
  18. P = Grab
  19. ]])
  20. print("Hope you enjoy!")
  21. local shoot = Instance.new("Sound",char)
  22. shoot.SoundId = "rbxassetid://1895310553"
  23. shoot.Volume = 4
  24. shoot.Name = "BluePortalShoot"
  25. local shoot2 = Instance.new("Sound",char)
  26. shoot2.SoundId = "rbxassetid://142774034"
  27. shoot2.Volume = 4
  28. shoot2.Name = "OrangePortalShoot"
  29. local grab = Instance.new("Sound",char)
  30. grab.SoundId = "rbxassetid://1895264203"
  31. grab.Volume = 4
  32. grab.Name = "GrabbingAObject"
  33. grab.Looped = true
  34. local theme = Instance.new("Sound",char)
  35. theme.SoundId = "rbxassetid://1195643760"
  36. theme.Volume = 0.7
  37. theme.Looped = true
  38. theme.Name = "atotallynotatheme"
  39. theme:Play()
  40. Mouse = plr:GetMouse()
  41.  
  42.  
  43. function GrabAPlayer(whom)
  44. if whom.Name ~= "Workspace" and whom.Name ~= char.Name then
  45. local vel = Instance.new("BodyVelocity",whom.Torso)
  46. vel.Velocity = Vector3.new(0,0,0)
  47. vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  48. grab:Play()
  49. coroutine.wrap(function()
  50. while true do
  51. wait()
  52. vel.Velocity = Mouse.Hit.lookVector * 10
  53. end
  54. end)()
  55. end
  56. end
  57. function StopGrabbing(whom)
  58. if whom.Name ~= "Workspace" and whom.Name ~= char.Name then
  59. grab:Stop()
  60. for i,v in pairs(whom.Torso:GetChildren()) do
  61. if v.ClassName == "BodyVelocity" then
  62. v:Destroy()
  63. end
  64. end
  65. end
  66. end
  67. hum = char:FindFirstChildOfClass("Humanoid")
  68. local subgui = Instance.new("ScreenGui",hum)
  69. local frm = Instance.new("Frame",subgui)
  70. frm.Size = UDim2.new(0, 1151, 0, 72)
  71. frm.Style = "DropShadow"
  72. frm.Position = UDim2.new(0.002, 0, 0.856, 0)
  73. local txt = Instance.new("TextLabel",frm)
  74. txt.Size = UDim2.new(0, 1133,0, 38)
  75. txt.Position = UDim2.new(0.014, 0,0.194, 0)
  76. txt.Name = "TextLabel"
  77. frm.BackgroundTransparency = 1
  78. txt.TextTransparency = 1
  79. txt.BackgroundTransparency = 1
  80. function displaysubtitles(actor, text, color, textscaled)
  81. local subgui2 = subgui:Clone()
  82. subgui2.Parent = plr.PlayerGui
  83. subgui2.Frame:FindFirstChildOfClass("TextLabel").Text = actor .. ": " .. text
  84. subgui2.Frame:FindFirstChildOfClass("TextLabel").TextColor3 = color
  85. subgui2.Frame:FindFirstChildOfClass("TextLabel").TextScaled = textscaled
  86. for i = 1,10 do
  87. subgui2.Frame.BackgroundTransparency = subgui2.Frame.BackgroundTransparency - 0.1
  88. subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency = subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency - 0.1
  89. game:GetService("RunService").RenderStepped:wait()
  90. end
  91. wait(1)
  92. for i = 1,10 do
  93. subgui2.Frame.BackgroundTransparency = subgui2.Frame.BackgroundTransparency + 0.1
  94. subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency = subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency + 0.1
  95. game:GetService("RunService").RenderStepped:wait()
  96. end
  97. subgui2:Destroy()
  98. end
  99.  
  100. displaysubtitles("System", "Controls are in output, enjoy!", BrickColor.new("Institutional white").Color, true)
  101. wallmode = false
  102. floormode = true
  103. subtitles = false
  104.  
  105. local portalgun = Instance.new("Part",char)
  106. portalgun.CanCollide = false
  107. portalgun.Size = Vector3.new(1.21, 2.22, 1.25)
  108. local mesh = Instance.new("FileMesh",portalgun)
  109. mesh.MeshId = "rbxassetid://483890463"
  110. mesh.TextureId = "rbxassetid://483890478"
  111. mesh.Scale = Vector3.new(0.1,0.1,0.1)
  112. local weld = Instance.new("Weld",portalgun)
  113. weld.Part0 = portalgun
  114. weld.Part1 = char["Right Arm"]
  115. weld.C0 = CFrame.new(0.152778625, -1.51120019, -0.68466568, 0.999933541, 0, -0.011528994, 4.91859246e-05, -0.999990761, 0.00426599709, -0.0115288896, -0.00426628068, -0.999924481)
  116. local Weld = Instance.new("Weld")
  117. Weld.Part0 = char.Torso
  118. Weld.Part1 = char["Right Arm"]
  119. Weld.Parent = char.Torso
  120.  
  121. local Weld2 = Instance.new("Weld")
  122. Weld2.Part0 = char.Torso
  123. Weld2.Part1 = char.Head
  124. Weld2.Parent = char.Torso
  125. Torso = char.Torso
  126. local RotationOffset = CFrame.Angles(math.rad(90),math.rad(0),0)
  127. local RotationOffsetHead = CFrame.Angles(0,0,0)
  128. local Scale = game.Players.LocalPlayer.Character.Torso.Size.X/2*(game.Players.LocalPlayer.Character.Torso:FindFirstChild("ScaleInserted") ~= nil and game.Players.LocalPlayer.Character.Torso:FindFirstChild("ScaleInserted").Scale.Z or 1)*0.8
  129. local Part0Joint = CFrame.new(Vector3.new(1,0.75,0)*Scale*1.25)
  130. local Part1Joint = CFrame.new(Vector3.new(-0.5,0.75,0)*Scale*1.25)
  131. RA = char["Right Arm"]
  132. local Part0JointHead = CFrame.new(Vector3.new(0,1,0)*Scale*1.25)
  133. local Part1JointHead = CFrame.new(Vector3.new(0,-0.5,0)*Scale*1.25)
  134. Character = char
  135. Barrel = portalgun
  136. IgnoreList = {"Terrain"}
  137. DB = false
  138. Down = false
  139. Humanoid = hum
  140. Portals = {}
  141. function portalopenblue(CF)
  142. local portal = Instance.new("Part",char)
  143. portal.Size = Vector3.new(7.16, 0.05, 5.73)
  144. portal.BrickColor = BrickColor.new("Toothpaste")
  145. portal.Material = Enum.Material.Neon
  146. portal.Anchored = true
  147. portal.CanCollide = false
  148. if floormode then
  149. portal.CFrame = CF
  150. portal.Orientation = Vector3.new(0,0,0)
  151. elseif wallmode then
  152. portal.CFrame = CF + Vector3.new(0,5,0)
  153. portal.Orientation = Vector3.new(0, 0, -90)
  154. end
  155. portal.Name = "PortalBlue"
  156. table.insert(Portals,1,portal)
  157. local mesh = Instance.new("SpecialMesh",portal)
  158. mesh.MeshType = Enum.MeshType.Sphere
  159. mesh.Scale = Vector3.new(0,0,0)
  160. for i = 1,10 do
  161. mesh.Scale = mesh.Scale + Vector3.new(0.1,0.1,0.1)
  162. game:GetService("RunService").RenderStepped:wait()
  163. end
  164. portal.Touched:connect(function(part)
  165. local human = part.Parent:FindFirstChildOfClass("Humanoid")
  166. if human then
  167. human.Parent.Torso.CFrame = Portals[2].CFrame + Vector3.new(0,5,0)
  168. if floormode then
  169. human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.upVector * 100
  170. elseif wallmode then
  171. human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.lookVector * 100
  172. end
  173. end
  174. end)
  175. end
  176. function portalopenorange(CF)
  177. local portal = Instance.new("Part",char)
  178. portal.Size = Vector3.new(7.16, 0.05, 5.73)
  179. portal.BrickColor = BrickColor.new("Neon orange")
  180. portal.Material = Enum.Material.Neon
  181. portal.Anchored = true
  182. portal.CanCollide = false
  183. if floormode then
  184. portal.CFrame = CF
  185. portal.Orientation = Vector3.new(0,0,0)
  186. elseif wallmode then
  187. portal.CFrame = CF + Vector3.new(0,5,0)
  188. portal.Orientation = Vector3.new(0, 0, -90)
  189. end
  190. portal.Name = "PortalOrange"
  191. table.insert(Portals,2,portal)
  192. local mesh = Instance.new("SpecialMesh",portal)
  193. mesh.MeshType = Enum.MeshType.Sphere
  194. mesh.Scale = Vector3.new(0,0,0)
  195. for i = 1,10 do
  196. mesh.Scale = mesh.Scale + Vector3.new(0.1,0.1,0.1)
  197. game:GetService("RunService").RenderStepped:wait()
  198. end
  199. portal.Touched:connect(function(part)
  200. local human = part.Parent:FindFirstChildOfClass("Humanoid")
  201. if human then
  202. human.Parent.Torso.CFrame = Portals[1].CFrame + Vector3.new(0,5,0)
  203. if floormode then
  204. human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.upVector * 100
  205. elseif wallmode then
  206. human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.lookVector * 100
  207. end
  208. end
  209. end)
  210. end
  211. function fade(object)
  212. for i = 1,10 do
  213. object.Transparency = object.Transparency + 0.1
  214. game:GetService("RunService").RenderStepped:wait()
  215. end
  216. object:Destroy()
  217. end
  218. using = false
  219. Mouse.KeyDown:connect(function(k)
  220. if k == "rmb" then
  221. if not using then
  222. if not DB then
  223. DB = true
  224. shoot2:Play()
  225. for i = 1,20,7.5 do
  226. RotationOffset = RotationOffset*CFrame.Angles(math.rad(7.5),0,0)
  227. Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,-0.15,0)*Scale)
  228. game["Run Service"].RenderStepped:wait()
  229. end
  230. portalopenorange(Mouse.Hit)
  231. wait(0.02)
  232. for i = 1,20,3.75 do
  233. RotationOffset = RotationOffset*CFrame.Angles(math.rad(-3.75),0,0)
  234. Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,0.075,0)*Scale)
  235. game["Run Service"].RenderStepped:wait()
  236. end
  237. wait(0.02)
  238. DB = false
  239. if subtitles then
  240. displaysubtitles("System",plr.Name .. " has placed a orange portal", BrickColor.new("Institutional white").Color, true)
  241. end
  242. end
  243. end
  244. end
  245. if k == "t" then
  246. table.remove(Portals,1)
  247. table.remove(Portals,2)
  248. for i,v in pairs(char:GetChildren()) do
  249. if v.Name == "PortalBlue" then
  250. fade(v)
  251. end
  252. end
  253. for i,v in pairs(char:GetChildren()) do
  254. if v.Name == "PortalOrange" then
  255. fade(v)
  256. end
  257. end
  258. if subtitles then
  259. displaysubtitles("System",plr.Name .. " has cleared all of his portals", BrickColor.new("Institutional white").Color, true)
  260. end
  261. end
  262. if k == "f" then
  263. warn("Wall mode activated")
  264. wallmode = true
  265. floormode = false
  266. end
  267. if k == "g" then
  268. warn("Wall mode deactivated")
  269. wallmode = false
  270. floormode = true
  271. end
  272. if k == "h" then
  273. warn("Subtitles activated")
  274. subtitles = true
  275. end
  276. if k == "j" then
  277. warn("Subtitles deactivated")
  278. subtitles = false
  279. end
  280. if k == "p" then
  281. GrabAPlayer(Mouse.Target.Parent)
  282. end
  283. end)
  284. Mouse.KeyUp:connect(function(k)
  285. if k == "p" then
  286. StopGrabbing(Mouse.Target.Parent)
  287. end
  288. end)
  289.  
  290. Mouse.Button1Down:connect(function()
  291. if not using then
  292. if not DB then
  293. DB = true
  294. shoot:Play()
  295. for i = 1,20,7.5 do
  296. RotationOffset = RotationOffset*CFrame.Angles(math.rad(7.5),0,0)
  297. Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,-0.15,0)*Scale)
  298. game["Run Service"].RenderStepped:wait()
  299. end
  300. portalopenblue(Mouse.Hit)
  301. wait(0.02)
  302. for i = 1,20,3.75 do
  303. RotationOffset = RotationOffset*CFrame.Angles(math.rad(-3.75),0,0)
  304. Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,0.075,0)*Scale)
  305. game["Run Service"].RenderStepped:wait()
  306. end
  307. wait(0.02)
  308. DB = false
  309. if subtitles then
  310. displaysubtitles("System",plr.Name .. " has placed a blue portal", BrickColor.new("Institutional white").Color, true)
  311. end
  312. end
  313. end
  314. end)
  315.  
  316.  
  317.  
  318. function swait(num)
  319. if num==0 or num==nil then
  320. game:service'RunService'.Stepped:wait(0)
  321. else
  322. for i=0,num do
  323. game:service'RunService'.Stepped:wait(0)
  324. end
  325. end
  326. end
  327.  
  328. function chatfunc(text)
  329. local chat = coroutine.wrap(function()
  330. if char:FindFirstChild("TalkingBillBoard")~= nil then
  331. char:FindFirstChild("TalkingBillBoard"):destroy()
  332. end
  333. local naeeym2 = Instance.new("BillboardGui",char)
  334. naeeym2.Size = UDim2.new(0,100,0,40)
  335. naeeym2.StudsOffset = Vector3.new(0,3,0)
  336. naeeym2.Adornee = char.Head
  337. naeeym2.Name = "TalkingBillBoard"
  338. local tecks2 = Instance.new("TextLabel",naeeym2)
  339. tecks2.BackgroundTransparency = 1
  340. tecks2.BorderSizePixel = 0
  341. tecks2.Text = ""
  342. tecks2.Font = "Fantasy"
  343. tecks2.TextSize = 30
  344. tecks2.TextStrokeTransparency = 0
  345. tecks2.TextColor3 = Color3.new(.6,0,0)
  346. tecks2.TextStrokeColor3 = Color3.new(0,0,0)
  347. tecks2.Size = UDim2.new(1,0,0.5,0)
  348. local tecks3 = Instance.new("TextLabel",naeeym2)
  349. tecks3.BackgroundTransparency = 1
  350. tecks3.BorderSizePixel = 0
  351. tecks3.Text = ""
  352. tecks3.Font = "Fantasy"
  353. tecks3.TextSize = 30
  354. tecks3.TextStrokeTransparency = 0
  355. tecks3.TextColor3 = BrickColor.new("Institutional white").Color
  356. tecks3.TextStrokeColor3 = BrickColor.new("Really black").Color
  357. tecks3.Size = UDim2.new(1,0,0.5,0)
  358. for i = 1,string.len(text),1 do
  359. tecks2.Text = string.sub(text,1,i)
  360. tecks3.Text = string.sub(text,1,i)
  361. wait(0.01)
  362. end
  363. wait(2)
  364. for i = 1, 50 do
  365. swait()
  366. tecks2.Position = tecks2.Position - UDim2.new(math.random(-.4,.4),math.random(-5,5),.05,math.random(-5,5))
  367. tecks2.Rotation = tecks2.Rotation - .8
  368. tecks2.TextStrokeTransparency = tecks2.TextStrokeTransparency +.04
  369. tecks2.TextTransparency = tecks2.TextTransparency + .04
  370. tecks3.Position = tecks2.Position - UDim2.new(math.random(-.4,.4),math.random(-5,5),.05,math.random(-5,5))
  371. tecks3.Rotation = tecks2.Rotation + .8
  372. tecks3.TextStrokeTransparency = tecks2.TextStrokeTransparency +.04
  373. tecks3.TextTransparency = tecks2.TextTransparency + .04
  374. end
  375. naeeym2:Destroy()
  376. end)
  377. chat()
  378. end
  379. function onChatted(msg)
  380. chatfunc(msg)
  381. end
  382. Quotes = {"F-f-f-f-fling yourself.", " Now that you are in control of both portals, this next test could take a very, VERY, long time.", "If you become light headed from thirst, feel free to pass out.", " You are kidding me. ", " Go ahead and break it. Hero. I don't care. "}
  383. Mouse.KeyUp:connect(function(k)
  384. if k == "y" then
  385. chatfunc(Quotes[math.random(1,5)])
  386. end
  387. end)
  388. game:GetService("RunService"):BindToRenderStep("Pistol",Enum.RenderPriority.Character.Value,function()
  389. local Point = Torso.CFrame:vectorToObjectSpace(Mouse.Hit.p-Torso.CFrame.p)
  390. if Point.Z > 0 then
  391. if Point.X > 0 then
  392. Torso.CFrame = CFrame.new(Torso.Position,Vector3.new(Mouse.Hit.X,Torso.Position.Y,Mouse.Hit.Z))*CFrame.Angles(0,math.rad(90),0)
  393. elseif Point.X < 0 then
  394. Torso.CFrame = CFrame.new(Torso.Position,Vector3.new(Mouse.Hit.X,Torso.Position.Y,Mouse.Hit.Z))*CFrame.Angles(0,math.rad(-90),0)
  395. end
  396. end
  397. shoot.Parent = char
  398. shoot.SoundId = "rbxassetid://1895310553"
  399. shoot.Volume = 4
  400. shoot2.Parent = char
  401. shoot2.SoundId = "rbxassetid://1895310118"
  402. shoot2.Volume = 4
  403. grab.Parent = char
  404. grab.SoundId = "rbxassetid://1895264203"
  405. grab.Volume = 4
  406. grab.Looped = true
  407. theme.Parent = char
  408. theme.SoundId = "rbxassetid://1195643760"
  409. theme.Volume = 0.7
  410. theme.Looped = true
  411. theme.Name = "atotallynotatheme"
  412. theme:Resume()
  413. local CFr = (Torso.CFrame*Part0Joint):toObjectSpace(CFrame.new((Torso.CFrame*Part0Joint).p,Mouse.Hit.p))--RayEnd))
  414. Weld.C0 = Part0Joint * (CFr-CFr.p) * RotationOffset
  415. Weld.C1 = Part1Joint
  416. Weld.Part0 = Torso
  417. Weld.Part1 = RA
  418. local CFr = (Torso.CFrame*Part0JointHead):toObjectSpace(CFrame.new((Torso.CFrame*Part0JointHead).p,Mouse.Hit.p))--RayEnd))
  419. Weld2.C0 = Part0JointHead * (CFr-CFr.p) * RotationOffsetHead
  420. Weld2.C1 = Part1JointHead
  421. Weld2.Part0 = Torso
  422. Weld2.Part1 = Character.Head
  423. local Last = Scale
  424. Scale = game.Players.LocalPlayer.Character.Torso.Size.X/2*(game.Players.LocalPlayer.Character.Torso:FindFirstChild("ScaleInserted") ~= nil and game.Players.LocalPlayer.Character.Torso:FindFirstChild("ScaleInserted").Scale.Z or 1)*0.8
  425. Speed = 20*Scale
  426. if Scale ~= Last then
  427. Part0Joint = CFrame.new(Vector3.new(1,0.75,0)*Scale*1.25)
  428. Part1Joint = CFrame.new(Vector3.new(-0.5,0.75,0)*Scale*1.25)
  429. Part0JointHead = CFrame.new(Vector3.new(0,1,0)*Scale*1.25)
  430. Part1JointHead = CFrame.new(Vector3.new(0,-0.5,0)*Scale*1.25)
  431. end
  432. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement