Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouse = game.Players.LocalPlayer:GetMouse()
- gun = Instance.new("Part", game.Players.LocalPlayer.Character)
- gun.Size = Vector3.new(0.5, 1, 2)
- gun.CanCollide = false
- gun:BreakJoints()
- weld = Instance.new("Weld", gun)
- weld.Part0 = game.Players.LocalPlayer.Character["Right Arm"]
- weld.Part1 = gun
- mesh = Instance.new("SpecialMesh", gun)
- mesh.MeshId = "rbxassetid://430056568"
- mesh.TextureId = "rbxassetid://430056584"
- portalmoosic = Instance.new("Sound", game.Players.LocalPlayer.Character)
- portalmoosic.SoundId = "rbxassetid://142300248"
- portalmoosic.Looped = true
- portalmoosic:Play()
- impact = Instance.new("Sound", game.Players.LocalPlayer.Character)
- impact.SoundId = "rbxassetid://142082170"
- mesh.Scale = Vector3.new(0.17,0.17,0.17)
- weld.C0 = weld.C0 * CFrame.new(-0.2,-1.3,-0.8) * CFrame.Angles(3,0,0)
- local rhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
- rhandweld.Part0 = game.Players.LocalPlayer.Character.Torso
- rhandweld.Part1 = game.Players.LocalPlayer.Character["Right Arm"]
- rhandweld.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- rhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- local lhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
- lhandweld.Part0 = game.Players.LocalPlayer.Character.Torso
- lhandweld.Part1 = game.Players.LocalPlayer.Character["Left Arm"]
- lhandweld.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- lhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Pick = Instance.new("Sound", gun)
- Pick.SoundId = "rbxassetid://291256829"
- Pick:Play()
- Shoot = Instance.new("Sound", gun)
- Shoot.SoundId = "rbxassetid://142774034"
- blueexists = false
- tping = false
- orangeexists = false
- for i = 0,1 , 0.1 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,-0.2,-0.28),i)
- rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.28),i)
- end
- for i = 0,1 , 0.1 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.new(0,-0.25,0),i)
- end
- using = false
- orange = false
- blue = true
- function changeportals(key)
- key = key:lower()
- if key == "q" then
- if not blue then
- blue = true
- orange = false
- end
- end
- if key == "e" then
- if not orange then
- blue = false
- orange = true
- end
- end
- end
- function portal()
- if not using then
- using = true
- if blue then
- Shoot:Play()
- local projectile = Instance.new("Part", workspace)
- projectile.Size = Vector3.new(1,1,1)
- projectile.BrickColor = BrickColor.new("Electric blue")
- projectile.Shape = "Ball"
- projectile.CanCollide = true
- projectile.Anchored = false
- projectile.Material = "Neon"
- local vel = Instance.new("BodyVelocity", projectile)
- vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- vel.Velocity = mouse.Hit.lookVector * 80
- projectile.Position = gun.CFrame.p
- wait(0.03)
- local function make(part)
- local gr = part.Parent:findFirstChild("Part")
- local porjectileposition = projectile.Position
- local portaldoor = Instance.new("Part", workspace)
- portaldoor.Size = Vector3.new(1, 1, 1)
- portaldoor.BrickColor = BrickColor.new("Electric blue")
- portaldoor.Anchored = true
- portaldoor.Shape = "Cylinder"
- portaldoor.Material = "Neon"
- portaldoor.CanCollide = false
- if blueexists == true then
- workspace.BluePortal:destroy()
- end
- blueexists = true
- portaldoor.Name = "BluePortal"
- portaldoor.CFrame = part.CFrame
- if part.Size.y < part.Size.x and part.Size.y < part.Size.z then --a big help from Toxsikkilla
- print("if y < x")
- portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.pi / 2)
- elseif part.Size.x < part.Size.y and part.Size.x < part.Size.z then
- print("if x < y")
- portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
- elseif part.Size.z < part.Size.y and part.Size.z < part.Size.y then
- print("if z < y")
- portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi / 2, 0)
- end
- portaldoor.Position = projectile.Position
- projectile:destroy()
- for i = 1,18 do
- portaldoor.Size = portaldoor.Size + Vector3.new(0,0.3,0.3)
- wait()
- end
- local function tp(part)
- local hum = part.Parent:findFirstChild("Humanoid")
- if hum ~= nil and blueexists and orangeexists and not tping then
- tping = true
- local tor = part.Parent:findFirstChild("Torso")
- if tor then
- local velocityoftorso = tor.Velocity
- local blport = workspace:findFirstChild("OrangePortal")
- if blport then
- tor.CFrame = workspace.OrangePortal.CFrame
- tor.Velocity = workspace.OrangePortal.CFrame.rightVector * -velocityoftorso * 1.7
- end
- end
- wait(0.3)
- tping = false
- end
- if not hum and blueexists and orangeexists and not tping then
- tping = true
- local cube = part.Parent:findFirstChild("Cube")
- if cube then
- tping = true
- local velocityoftorso = cube.Velocity
- cube.CFrame = workspace.OrangePortal.CFrame
- cube.Velocity = workspace.OrangePortal.CFrame.rightVector * -velocityoftorso * 1.7
- wait(0.3)
- tping = false
- end
- end
- wait(0.3)
- tping = false
- end
- portaldoor.Touched:connect(tp)
- end
- projectile.Touched:connect(make)
- end
- if orange then
- Shoot:Play()
- local projectile1 = Instance.new("Part", workspace)
- projectile1.Size = Vector3.new(1,1,1)
- projectile1.BrickColor = BrickColor.new("Deep orange")
- projectile1.Shape = "Ball"
- projectile1.CanCollide = true
- projectile1.Anchored = false
- projectile1.Material = "Neon"
- local vel1 = Instance.new("BodyVelocity", projectile1)
- vel1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- vel1.Velocity = mouse.Hit.lookVector * 80
- projectile1.Position = gun.CFrame.p
- wait(0.03)
- local function make1(part)
- local gr = part.Parent:findFirstChild("Part")
- local portaldoor = Instance.new("Part", workspace)
- portaldoor.Size = Vector3.new(1, 1, 1)
- portaldoor.BrickColor = BrickColor.new("Deep orange")
- portaldoor.Anchored = true
- portaldoor.Material = "Neon"
- portaldoor.Shape = "Cylinder"
- portaldoor.CanCollide = false
- if orangeexists == true then
- workspace.OrangePortal:destroy()
- end
- portaldoor.CFrame = part.CFrame
- if part.Size.y < part.Size.x and part.Size.y < part.Size.z then --a big help from Toxsikkilla
- print("if y < x")
- portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.pi / 2)
- elseif part.Size.x < part.Size.y and part.Size.x < part.Size.z then
- print("if x < y")
- portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
- elseif part.Size.z < part.Size.y and part.Size.z < part.Size.y then
- print("if z < y")
- portaldoor.CFrame = portaldoor.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi / 2, 0)
- end
- portaldoor.Position = projectile1.Position
- projectile1:destroy()
- for i = 1,18 do
- portaldoor.Size = portaldoor.Size + Vector3.new(0,0.3,0.3)
- wait()
- end
- orangeexists = true
- portaldoor.Name = "OrangePortal"
- local function tp(part)
- local hum = part.Parent:findFirstChild("Humanoid")
- if hum ~= nil and blueexists and orangeexists and not tping then
- tping = true
- local tor = part.Parent:findFirstChild("Torso")
- if tor then
- local velocityoftorso = tor.Velocity
- local blport = workspace:findFirstChild("BluePortal")
- if blport then
- tor.CFrame = workspace.BluePortal.CFrame
- tor.Velocity = workspace.BluePortal.CFrame.rightVector * -velocityoftorso * 1.7
- end
- end
- wait(0.3)
- tping = false
- end
- if not hum and blueexists and orangeexists and not tping then
- tping = true
- local cube = part.Parent:findFirstChild("Cube")
- if cube then
- tping = true
- local velocityoftorso = cube.Velocity
- local blport = workspace:findFirstChild("BluePortal")
- if velocityoftorso.y < velocityoftorso.z and velocityoftorso.y < velocityoftorso.x then
- cube.Velocity = -velocityoftorso * 1.5
- if blport then
- cube.CFrame = workspace.BluePortal.rightVector * -velocityoftorso * 1.7
- end
- end
- wait(0.3)
- tping = false
- end
- wait(0.3)
- tping = false
- end
- wait(0.3)
- tping = false
- end
- portaldoor.Touched:connect(tp)
- end
- projectile1.Touched:connect(make1)
- end
- for i = 0,1 , 0.3 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
- rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
- end
- for i = 0,1 , 0.3 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
- rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
- end
- using = false
- end
- end
- function remove(key)
- key = key:lower()
- if key == "r" then
- if blueexists or orangeexists or blueexists and orangeexists then
- workspace.OrangePortal:destroy()
- workspace.BluePortal:destroy()
- orangeexists = false
- blueexists = false
- end
- end
- end
- impacting = false
- cubesp = false
- function cubespawn(key)
- key = key:lower()
- if key == "c" then
- if cubesp then
- workspace.Cube:destroy()
- end
- cubesp = true
- local coobe = Instance.new("Part", workspace)
- coobe.Size = Vector3.new(2.774, 2.834, 2.804)
- coobe:BreakJoints()
- coobe.Position = game.Players.LocalPlayer.Character.Torso.Position
- coobe.Name = "Cube"
- local meh = Instance.new("SpecialMesh", coobe)
- meh.MeshId = "rbxassetid://464957313"
- meh.TextureId = "rbxassetid://464957325"
- meh.Scale = Vector3.new(0.8,0.8,0.8)
- local function sounds()
- if not impacting then
- impacting = true
- local impactspeed = math.random(0.9,1.1)
- impact.PlaybackSpeed = impactspeed
- impact:Play()
- wait(0.2)
- impacting = false
- end
- end
- coobe.Touched:connect(sounds)
- end
- end
- function deleterportalsondedth()
- if orangeexists or blueexists or blueexists and orangeexists then
- workspace.OrangePortal:destroy()
- workspace.BluePortal:destroy()
- if cubesp then
- workspace.Cube:destroy()
- end
- end
- end
- game.Players.LocalPlayer.Character.Humanoid.Died:connect(deleterportalsondedth)
- mouse.KeyDown:connect(cubespawn)
- mouse.Button1Down:connect(portal)
- mouse.KeyDown:connect(changeportals)
- mouse.KeyDown:connect(remove)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement