Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Portal Gun by Theamazingnater
- plr = game.Players.LocalPlayer
- repeat wait() until plr.Character
- char = plr.Character
- print("By Theamazingnater")
- print("Portal Gun Controls:" .. [[
- Left Mouse Button = Shoot Blue Portal
- E = Shoot Orange Portal
- T = Clear All Portals
- Y = Quotes from Glados
- F = Wall Mode (allows you to place portals on walls)
- G = Floor Mode (activated by default)
- H = Subtitles On
- J = Subtitles Off
- P = Grab
- ]])
- print("Hope you enjoy!")
- local shoot = Instance.new("Sound",char)
- shoot.SoundId = "rbxassetid://1895310553"
- shoot.Volume = 4
- shoot.Name = "BluePortalShoot"
- local shoot2 = Instance.new("Sound",char)
- shoot2.SoundId = "rbxassetid://142774034"
- shoot2.Volume = 4
- shoot2.Name = "OrangePortalShoot"
- local grab = Instance.new("Sound",char)
- grab.SoundId = "rbxassetid://1895264203"
- grab.Volume = 4
- grab.Name = "GrabbingAObject"
- grab.Looped = true
- local theme = Instance.new("Sound",char)
- theme.SoundId = "rbxassetid://1195643760"
- theme.Volume = 0.7
- theme.Looped = true
- theme.Name = "atotallynotatheme"
- theme:Play()
- Mouse = plr:GetMouse()
- function GrabAPlayer(whom)
- if whom.Name ~= "Workspace" and whom.Name ~= char.Name then
- local vel = Instance.new("BodyVelocity",whom.Torso)
- vel.Velocity = Vector3.new(0,0,0)
- vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- grab:Play()
- coroutine.wrap(function()
- while true do
- wait()
- vel.Velocity = Mouse.Hit.lookVector * 10
- end
- end)()
- end
- end
- function StopGrabbing(whom)
- if whom.Name ~= "Workspace" and whom.Name ~= char.Name then
- grab:Stop()
- for i,v in pairs(whom.Torso:GetChildren()) do
- if v.ClassName == "BodyVelocity" then
- v:Destroy()
- end
- end
- end
- end
- hum = char:FindFirstChildOfClass("Humanoid")
- local subgui = Instance.new("ScreenGui",hum)
- local frm = Instance.new("Frame",subgui)
- frm.Size = UDim2.new(0, 1151, 0, 72)
- frm.Style = "DropShadow"
- frm.Position = UDim2.new(0.002, 0, 0.856, 0)
- local txt = Instance.new("TextLabel",frm)
- txt.Size = UDim2.new(0, 1133,0, 38)
- txt.Position = UDim2.new(0.014, 0,0.194, 0)
- txt.Name = "TextLabel"
- frm.BackgroundTransparency = 1
- txt.TextTransparency = 1
- txt.BackgroundTransparency = 1
- function displaysubtitles(actor, text, color, textscaled)
- local subgui2 = subgui:Clone()
- subgui2.Parent = plr.PlayerGui
- subgui2.Frame:FindFirstChildOfClass("TextLabel").Text = actor .. ": " .. text
- subgui2.Frame:FindFirstChildOfClass("TextLabel").TextColor3 = color
- subgui2.Frame:FindFirstChildOfClass("TextLabel").TextScaled = textscaled
- for i = 1,10 do
- subgui2.Frame.BackgroundTransparency = subgui2.Frame.BackgroundTransparency - 0.1
- subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency = subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency - 0.1
- game:GetService("RunService").RenderStepped:wait()
- end
- wait(1)
- for i = 1,10 do
- subgui2.Frame.BackgroundTransparency = subgui2.Frame.BackgroundTransparency + 0.1
- subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency = subgui2.Frame:FindFirstChildOfClass("TextLabel").TextTransparency + 0.1
- game:GetService("RunService").RenderStepped:wait()
- end
- subgui2:Destroy()
- end
- displaysubtitles("System", "Controls are in output, enjoy!", BrickColor.new("Institutional white").Color, true)
- wallmode = false
- floormode = true
- subtitles = false
- local portalgun = Instance.new("Part",char)
- portalgun.CanCollide = false
- portalgun.Size = Vector3.new(1.21, 2.22, 1.25)
- local mesh = Instance.new("FileMesh",portalgun)
- mesh.MeshId = "rbxassetid://483890463"
- mesh.TextureId = "rbxassetid://483890478"
- mesh.Scale = Vector3.new(0.1,0.1,0.1)
- local weld = Instance.new("Weld",portalgun)
- weld.Part0 = portalgun
- weld.Part1 = char["Right Arm"]
- 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)
- local Weld = Instance.new("Weld")
- Weld.Part0 = char.Torso
- Weld.Part1 = char["Right Arm"]
- Weld.Parent = char.Torso
- local Weld2 = Instance.new("Weld")
- Weld2.Part0 = char.Torso
- Weld2.Part1 = char.Head
- Weld2.Parent = char.Torso
- Torso = char.Torso
- local RotationOffset = CFrame.Angles(math.rad(90),math.rad(0),0)
- local RotationOffsetHead = CFrame.Angles(0,0,0)
- 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
- local Part0Joint = CFrame.new(Vector3.new(1,0.75,0)*Scale*1.25)
- local Part1Joint = CFrame.new(Vector3.new(-0.5,0.75,0)*Scale*1.25)
- RA = char["Right Arm"]
- local Part0JointHead = CFrame.new(Vector3.new(0,1,0)*Scale*1.25)
- local Part1JointHead = CFrame.new(Vector3.new(0,-0.5,0)*Scale*1.25)
- Character = char
- Barrel = portalgun
- IgnoreList = {"Terrain"}
- DB = false
- Down = false
- Humanoid = hum
- Portals = {}
- function portalopenblue(CF)
- local portal = Instance.new("Part",char)
- portal.Size = Vector3.new(7.16, 0.05, 5.73)
- portal.BrickColor = BrickColor.new("Toothpaste")
- portal.Material = Enum.Material.Neon
- portal.Anchored = true
- portal.CanCollide = false
- if floormode then
- portal.CFrame = CF
- portal.Orientation = Vector3.new(0,0,0)
- elseif wallmode then
- portal.CFrame = CF + Vector3.new(0,5,0)
- portal.Orientation = Vector3.new(0, 0, -90)
- end
- portal.Name = "PortalBlue"
- table.insert(Portals,1,portal)
- local mesh = Instance.new("SpecialMesh",portal)
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Scale = Vector3.new(0,0,0)
- for i = 1,10 do
- mesh.Scale = mesh.Scale + Vector3.new(0.1,0.1,0.1)
- game:GetService("RunService").RenderStepped:wait()
- end
- portal.Touched:connect(function(part)
- local human = part.Parent:FindFirstChildOfClass("Humanoid")
- if human then
- human.Parent.Torso.CFrame = Portals[2].CFrame + Vector3.new(0,5,0)
- if floormode then
- human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.upVector * 100
- elseif wallmode then
- human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.lookVector * 100
- end
- end
- end)
- end
- function portalopenorange(CF)
- local portal = Instance.new("Part",char)
- portal.Size = Vector3.new(7.16, 0.05, 5.73)
- portal.BrickColor = BrickColor.new("Neon orange")
- portal.Material = Enum.Material.Neon
- portal.Anchored = true
- portal.CanCollide = false
- if floormode then
- portal.CFrame = CF
- portal.Orientation = Vector3.new(0,0,0)
- elseif wallmode then
- portal.CFrame = CF + Vector3.new(0,5,0)
- portal.Orientation = Vector3.new(0, 0, -90)
- end
- portal.Name = "PortalOrange"
- table.insert(Portals,2,portal)
- local mesh = Instance.new("SpecialMesh",portal)
- mesh.MeshType = Enum.MeshType.Sphere
- mesh.Scale = Vector3.new(0,0,0)
- for i = 1,10 do
- mesh.Scale = mesh.Scale + Vector3.new(0.1,0.1,0.1)
- game:GetService("RunService").RenderStepped:wait()
- end
- portal.Touched:connect(function(part)
- local human = part.Parent:FindFirstChildOfClass("Humanoid")
- if human then
- human.Parent.Torso.CFrame = Portals[1].CFrame + Vector3.new(0,5,0)
- if floormode then
- human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.upVector * 100
- elseif wallmode then
- human.Parent.Torso.Velocity = human.Parent.Torso.CFrame.lookVector * 100
- end
- end
- end)
- end
- function fade(object)
- for i = 1,10 do
- object.Transparency = object.Transparency + 0.1
- game:GetService("RunService").RenderStepped:wait()
- end
- object:Destroy()
- end
- using = false
- Mouse.KeyDown:connect(function(k)
- if k == "rmb" then
- if not using then
- if not DB then
- DB = true
- shoot2:Play()
- for i = 1,20,7.5 do
- RotationOffset = RotationOffset*CFrame.Angles(math.rad(7.5),0,0)
- Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,-0.15,0)*Scale)
- game["Run Service"].RenderStepped:wait()
- end
- portalopenorange(Mouse.Hit)
- wait(0.02)
- for i = 1,20,3.75 do
- RotationOffset = RotationOffset*CFrame.Angles(math.rad(-3.75),0,0)
- Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,0.075,0)*Scale)
- game["Run Service"].RenderStepped:wait()
- end
- wait(0.02)
- DB = false
- if subtitles then
- displaysubtitles("System",plr.Name .. " has placed a orange portal", BrickColor.new("Institutional white").Color, true)
- end
- end
- end
- end
- if k == "t" then
- table.remove(Portals,1)
- table.remove(Portals,2)
- for i,v in pairs(char:GetChildren()) do
- if v.Name == "PortalBlue" then
- fade(v)
- end
- end
- for i,v in pairs(char:GetChildren()) do
- if v.Name == "PortalOrange" then
- fade(v)
- end
- end
- if subtitles then
- displaysubtitles("System",plr.Name .. " has cleared all of his portals", BrickColor.new("Institutional white").Color, true)
- end
- end
- if k == "f" then
- warn("Wall mode activated")
- wallmode = true
- floormode = false
- end
- if k == "g" then
- warn("Wall mode deactivated")
- wallmode = false
- floormode = true
- end
- if k == "h" then
- warn("Subtitles activated")
- subtitles = true
- end
- if k == "j" then
- warn("Subtitles deactivated")
- subtitles = false
- end
- if k == "p" then
- GrabAPlayer(Mouse.Target.Parent)
- end
- end)
- Mouse.KeyUp:connect(function(k)
- if k == "p" then
- StopGrabbing(Mouse.Target.Parent)
- end
- end)
- Mouse.Button1Down:connect(function()
- if not using then
- if not DB then
- DB = true
- shoot:Play()
- for i = 1,20,7.5 do
- RotationOffset = RotationOffset*CFrame.Angles(math.rad(7.5),0,0)
- Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,-0.15,0)*Scale)
- game["Run Service"].RenderStepped:wait()
- end
- portalopenblue(Mouse.Hit)
- wait(0.02)
- for i = 1,20,3.75 do
- RotationOffset = RotationOffset*CFrame.Angles(math.rad(-3.75),0,0)
- Part1Joint = Part1Joint*CFrame.new(Vector3.new(0,0.075,0)*Scale)
- game["Run Service"].RenderStepped:wait()
- end
- wait(0.02)
- DB = false
- if subtitles then
- displaysubtitles("System",plr.Name .. " has placed a blue portal", BrickColor.new("Institutional white").Color, true)
- end
- end
- end
- end)
- function swait(num)
- if num==0 or num==nil then
- game:service'RunService'.Stepped:wait(0)
- else
- for i=0,num do
- game:service'RunService'.Stepped:wait(0)
- end
- end
- end
- function chatfunc(text)
- local chat = coroutine.wrap(function()
- if char:FindFirstChild("TalkingBillBoard")~= nil then
- char:FindFirstChild("TalkingBillBoard"):destroy()
- end
- local naeeym2 = Instance.new("BillboardGui",char)
- naeeym2.Size = UDim2.new(0,100,0,40)
- naeeym2.StudsOffset = Vector3.new(0,3,0)
- naeeym2.Adornee = char.Head
- naeeym2.Name = "TalkingBillBoard"
- local tecks2 = Instance.new("TextLabel",naeeym2)
- tecks2.BackgroundTransparency = 1
- tecks2.BorderSizePixel = 0
- tecks2.Text = ""
- tecks2.Font = "Fantasy"
- tecks2.TextSize = 30
- tecks2.TextStrokeTransparency = 0
- tecks2.TextColor3 = Color3.new(.6,0,0)
- tecks2.TextStrokeColor3 = Color3.new(0,0,0)
- tecks2.Size = UDim2.new(1,0,0.5,0)
- local tecks3 = Instance.new("TextLabel",naeeym2)
- tecks3.BackgroundTransparency = 1
- tecks3.BorderSizePixel = 0
- tecks3.Text = ""
- tecks3.Font = "Fantasy"
- tecks3.TextSize = 30
- tecks3.TextStrokeTransparency = 0
- tecks3.TextColor3 = BrickColor.new("Institutional white").Color
- tecks3.TextStrokeColor3 = BrickColor.new("Really black").Color
- tecks3.Size = UDim2.new(1,0,0.5,0)
- for i = 1,string.len(text),1 do
- tecks2.Text = string.sub(text,1,i)
- tecks3.Text = string.sub(text,1,i)
- wait(0.01)
- end
- wait(2)
- for i = 1, 50 do
- swait()
- tecks2.Position = tecks2.Position - UDim2.new(math.random(-.4,.4),math.random(-5,5),.05,math.random(-5,5))
- tecks2.Rotation = tecks2.Rotation - .8
- tecks2.TextStrokeTransparency = tecks2.TextStrokeTransparency +.04
- tecks2.TextTransparency = tecks2.TextTransparency + .04
- tecks3.Position = tecks2.Position - UDim2.new(math.random(-.4,.4),math.random(-5,5),.05,math.random(-5,5))
- tecks3.Rotation = tecks2.Rotation + .8
- tecks3.TextStrokeTransparency = tecks2.TextStrokeTransparency +.04
- tecks3.TextTransparency = tecks2.TextTransparency + .04
- end
- naeeym2:Destroy()
- end)
- chat()
- end
- function onChatted(msg)
- chatfunc(msg)
- end
- 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. "}
- Mouse.KeyUp:connect(function(k)
- if k == "y" then
- chatfunc(Quotes[math.random(1,5)])
- end
- end)
- game:GetService("RunService"):BindToRenderStep("Pistol",Enum.RenderPriority.Character.Value,function()
- local Point = Torso.CFrame:vectorToObjectSpace(Mouse.Hit.p-Torso.CFrame.p)
- if Point.Z > 0 then
- if Point.X > 0 then
- Torso.CFrame = CFrame.new(Torso.Position,Vector3.new(Mouse.Hit.X,Torso.Position.Y,Mouse.Hit.Z))*CFrame.Angles(0,math.rad(90),0)
- elseif Point.X < 0 then
- Torso.CFrame = CFrame.new(Torso.Position,Vector3.new(Mouse.Hit.X,Torso.Position.Y,Mouse.Hit.Z))*CFrame.Angles(0,math.rad(-90),0)
- end
- end
- shoot.Parent = char
- shoot.SoundId = "rbxassetid://1895310553"
- shoot.Volume = 4
- shoot2.Parent = char
- shoot2.SoundId = "rbxassetid://1895310118"
- shoot2.Volume = 4
- grab.Parent = char
- grab.SoundId = "rbxassetid://1895264203"
- grab.Volume = 4
- grab.Looped = true
- theme.Parent = char
- theme.SoundId = "rbxassetid://1195643760"
- theme.Volume = 0.7
- theme.Looped = true
- theme.Name = "atotallynotatheme"
- theme:Resume()
- local CFr = (Torso.CFrame*Part0Joint):toObjectSpace(CFrame.new((Torso.CFrame*Part0Joint).p,Mouse.Hit.p))--RayEnd))
- Weld.C0 = Part0Joint * (CFr-CFr.p) * RotationOffset
- Weld.C1 = Part1Joint
- Weld.Part0 = Torso
- Weld.Part1 = RA
- local CFr = (Torso.CFrame*Part0JointHead):toObjectSpace(CFrame.new((Torso.CFrame*Part0JointHead).p,Mouse.Hit.p))--RayEnd))
- Weld2.C0 = Part0JointHead * (CFr-CFr.p) * RotationOffsetHead
- Weld2.C1 = Part1JointHead
- Weld2.Part0 = Torso
- Weld2.Part1 = Character.Head
- local Last = Scale
- 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
- Speed = 20*Scale
- if Scale ~= Last then
- Part0Joint = CFrame.new(Vector3.new(1,0.75,0)*Scale*1.25)
- Part1Joint = CFrame.new(Vector3.new(-0.5,0.75,0)*Scale*1.25)
- Part0JointHead = CFrame.new(Vector3.new(0,1,0)*Scale*1.25)
- Part1JointHead = CFrame.new(Vector3.new(0,-0.5,0)*Scale*1.25)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement