r16

Untitled

r16
Jan 17th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.48 KB | None | 0 0
  1. plr=game:service'Players'.LocalPlayer ch,char=plr.Character,plr.Character hum=ch.Humanoid tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint m,mouse=plr:GetMouse(),plr:GetMouse() cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new bc=BrickColor.new head=ch.Head cam=workspace.CurrentCamera rj.C0=cfn() rj.C1=cfn() getSound=function(id) game:service'ContentProvider':Preload('rbxassetid'..tostring(id)) local s=int("Sound",ch.Head) s.SoundId='rbxassetid://' .. tostring(id) s.Volume=1 return s end if ch:findFirstChild("Portal Gun") then ch['Portal Gun']:Destroy() end local tube=int("Model",ch) tube.Name='Portal Gun' Weld = function(p0,p1,x,y,z,rx,ry,rz,par) p0.Position = p1.Position local w = Instance.new('Motor',par or p0) w.Part0 = p1 w.Part1 = p0 w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0) w.MaxVelocity = .1 return w end function clerp(c1,c2,sp) local R1,R2,R3 = c1:toEulerAnglesXYZ() local R21,R22,R23 = c2:toEulerAnglesXYZ() return CFrame.new( c1.X + (c2.X-c1.X)*sp, c1.Y + (c2.Y-c1.Y)*sp, c1.Z + (c2.Z-c1.Z)*sp)*CFrame.Angles( R1 + (R21-R1)*sp, R2 + (R22-R2)*sp, R3 + (R23-R3)*sp ) end tweenTable={} Tween = function(Weld, Stop, Step,a) ypcall(function() local func = function() local Start = Weld.C1 local X1, Y1, Z1 = Start:toEulerAnglesXYZ() local Stop = Stop local X2, Y2, Z2 = Stop:toEulerAnglesXYZ() if not Step then Step=0.1 end table.insert(tweenTable,{th=0,Weld=Weld,Step=Step,Start=Start,X1=X1,Y1=Y1,Z1=Z1,Stop=Stop,X2=X2,Y2=Y2,Z2=Z2}) end if a then coroutine.wrap(func)() else func() end end) end weld=function(p0,p1,c0) local w=Instance.new("Weld",p0) w.Part0=p0 w.Part1=p1 w.C0=c0 return w end cp=function(parent,color,size,anchored,cancollide) local newp=Instance.new("Part",parent) newp.TopSurface='SmoothNoOutlines' newp.BottomSurface='SmoothNoOutlines' newp.FrontSurface='SmoothNoOutlines' newp.BackSurface='SmoothNoOutlines' newp.RightSurface='SmoothNoOutlines' newp.LeftSurface='SmoothNoOutlines' newp.FormFactor="Custom" newp.BrickColor=bc(color) newp.Size=size newp.Anchored=anchored newp.CanCollide=cancollide newp:BreakJoints() return newp end initializeJoints=function() rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker' rabr.Position = torso.Position rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw' w = Instance.new("Weld",tube) w.Part0,w.Part1 = ch['Right Arm'],rabr w.C1 = CFrame.new(0,-.5,0) labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker' labr.Position = torso.Position lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw' ww = Instance.new("Weld",tube) ww.Part0,ww.Part1 = ch['Left Arm'],labr ww.C1 = CFrame.new(0,-.5,0) end cyl=function(prt) local c=int("CylinderMesh",prt) return c end blo=function(prt) local c=int("BlockMesh",prt) return c end local band=cp(tube,'Mid gray',Vector3.new(1.01,0.35,1.01)) band.Material='Metal' weld(ch['Right Arm'],band,cfn()) local neon=cp(tube,'Bright blue',Vector3.new(1.02,0.15,1.02)) neon.Material='Neon' weld(band,neon,cfn()) current=1 local bluep=nil local orap=nil createPortal=function(typ,cfram) local col=nil if current==1 then col='Bright blue' else col='Bright orange' end local newp=cp(tube,col,Vector3.new(6,0.2,6)) newp.Material='Neon' newp.Anchored=false local cm=cyl(newp) cm.Scale=Vector3.new(0,1,0) newp.CFrame=cfram if current==1 then ypcall(function() bluep:Destroy() bluep=nil end) bluep=newp current=2 else ypcall(function() orap:Destroy() orap=nil end) orap=newp current=1 end spawn(function() for i=1,5 do wait() cm.Scale=cm.Scale+Vector3.new(0.3,0,0.3) end end) return newp end deb=false m.KeyDown:connect(function(key) if key=='e' then local ray = Ray.new(neon.CFrame.p, (mouse.Hit.p - neon.CFrame.p).unit*300) local hit, position = workspace:FindPartOnRay(ray, ch) local hit=m.Target local position=m.Hit.p local portal=createPortal(1,CFrame.new(position.x,position.y,position.z)) portal.Touched:connect(function(p) if p:IsDescendantOf(ch) and deb==false then deb=true if tostring(portal.BrickColor)=='Bright blue' then ch.HumanoidRootPart.CFrame=ch.HumanoidRootPart.CFrame*CFrame.new(0,-1.3,0) for i=1,5 do wait() ch.HumanoidRootPart.CFrame=ch.HumanoidRootPart.CFrame*CFrame.new(0,-3,0) end ch.HumanoidRootPart.CFrame=orap.CFrame for i=1,5 do wait() ch.HumanoidRootPart.CFrame=ch.HumanoidRootPart.CFrame*CFrame.new(0,1.3,0) end else ch.HumanoidRootPart.CFrame=ch.HumanoidRootPart.CFrame*CFrame.new(0,-1.3,0) for i=1,5 do wait() ch.HumanoidRootPart.CFrame=ch.HumanoidRootPart.CFrame*CFrame.new(0,-3,0) end ch.HumanoidRootPart.CFrame=bluep.CFrame for i=1,5 do wait() ch.HumanoidRootPart.CFrame=ch.HumanoidRootPart.CFrame*CFrame.new(0,1.3,0) end end if not ch.HumanoidRootPart:FindFirstChild('BodyForce') then local bf=Instance.new('BodyForce') if tostring(portal.BrickColor)=='Bright blue' then bf.force=(orap.CFrame*CFrame.Angles(math.rad(90),0,0)).lookVector*15000 else bf.force=(bluep.CFrame*CFrame.Angles(math.rad(90),0,0)).lookVector*15000 end print(bf.force) bf.Parent=plr.Character.HumanoidRootPart print(bf.Parent) game.Debris:AddItem(bf,0.2) end wait(0.25) deb=false end end) local w = Instance.new("Weld") w.Part0 = mouse.Target w.Part1 = portal w.C0 = mouse.Target.CFrame:inverse() w.C1 = portal.CFrame:inverse() w.Parent = portal if position.y>ch.Torso.CFrame.y then print(m.TargetSurface) if m.TargetSurface==Enum.NormalId.Left then portal.CFrame=portal.CFrame*CFrame.Angles(math.rad(-90),0,math.rad(90)) elseif m.TargetSurface==Enum.NormalId.Back then portal.CFrame=portal.CFrame*CFrame.Angles(math.rad(90),0,0) elseif m.TargetSurface==Enum.NormalId.Front then portal.CFrame=portal.CFrame*CFrame.Angles(math.rad(-90),0,0) elseif m.TargetSurface==Enum.NormalId.Right then portal.CFrame=portal.CFrame*CFrame.Angles(math.rad(-90),0,math.rad(-90)) elseif m.TargetSurface==Enum.NormalId.Bottom then portal.CFrame=portal.CFrame*CFrame.Angles(math.rad(-90),0,0)*CFrame.Angles(math.rad(-90),0,0) end end portal.Anchored=true end end) torso.Velocity=portalDirection.unit * torso.Velocity.magnitude game:service'RunService'.RenderStepped:connect(function() for _,v in pairs(tweenTable) do if v.Weld.C1==Stop then table.remove(tweenTable,_) else if v.th<0.9 then v.th=v.th+v.Step i=v.th v.Weld.C1 = CFrame.new( (v.Start.p.X * (1 - i)) + (v.Stop.p.X * i), (v.Start.p.Y * (1 - i)) + (v.Stop.p.Y * i), (v.Start.p.Z * (1 - i)) + (v.Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ( (v.X1 * (1 - i)) + (v.X2 * i), (v.Y1 * (1 - i)) + (v.Y2 * i), (v.Z1 * (1 - i)) + (v.Z2 * i) ) else v.Weld.C1 = v.Stop end end end end)
Add Comment
Please, Sign In to add comment