EARTHWORM_SALLY

Untitled

Aug 11th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2.  
  3. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  4. do
  5. print("FE Compatibility code by Mokiros | Showcase By Bacon Hair!")
  6. script.Parent = Player.Character
  7.  
  8. --RemoteEvent for communicating
  9. local Event = Instance.new("RemoteEvent")
  10. Event.Name = "UserInput_Event"
  11.  
  12. --Fake event to make stuff like Mouse.KeyDown work
  13. local function fakeEvent()
  14. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  15. t.connect = t.Connect
  16. return t
  17. end
  18.  
  19. --Creating fake input objects with fake variables
  20. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  21. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  22. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  23. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  24. end}
  25. --Merged 2 functions into one by checking amount of arguments
  26. CAS.UnbindAction = CAS.BindAction
  27.  
  28. --This function will trigger the events that have been :Connect()'ed
  29. local function te(self,ev,...)
  30. local t = m[ev]
  31. if t and t._fakeEvent and t.Function then
  32. t.Function(...)
  33. end
  34. end
  35. m.TrigEvent = te
  36. UIS.TrigEvent = te
  37.  
  38. Event.OnServerEvent:Connect(function(plr,io)
  39. if plr~=Player then return end
  40. if io.isMouse then
  41. m.Target = io.Target
  42. m.Hit = io.Hit
  43. else
  44. local b = io.UserInputState == Enum.UserInputState.Begin
  45. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  46. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  47. end
  48. for _,t in pairs(CAS.Actions) do
  49. for _,k in pairs(t.Keys) do
  50. if k==io.KeyCode then
  51. t.Function(t.Name,io.UserInputState,io)
  52. end
  53. end
  54. end
  55. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  56. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  57. end
  58. end)
  59. Event.Parent = NLS([==[
  60. local Player = game:GetService("Players").LocalPlayer
  61. local Event = script:WaitForChild("UserInput_Event")
  62.  
  63. local UIS = game:GetService("UserInputService")
  64. local input = function(io,a)
  65. if a then return end
  66. --Since InputObject is a client-side instance, we create and pass table instead
  67. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  68. end
  69. UIS.InputBegan:Connect(input)
  70. UIS.InputEnded:Connect(input)
  71.  
  72. local Mouse = Player:GetMouse()
  73. local h,t
  74. --Give the server mouse data 30 times every second, but only if the values changed
  75. --If player is not moving their mouse, client won't fire events
  76. while wait(1/30) do
  77. if h~=Mouse.Hit or t~=Mouse.Target then
  78. h,t=Mouse.Hit,Mouse.Target
  79. Event:FireServer({isMouse=true,Target=t,Hit=h})
  80. end
  81. end]==],Player.Character)
  82. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  83. endif game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  84. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  85. do
  86. print("FE Compatibility code by Mokiros | Showcase By Bacon Hair!")
  87. script.Parent = Player.Character
  88.  
  89. --RemoteEvent for communicating
  90. local Event = Instance.new("RemoteEvent")
  91. Event.Name = "UserInput_Event"
  92.  
  93. --Fake event to make stuff like Mouse.KeyDown work
  94. local function fakeEvent()
  95. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  96. t.connect = t.Connect
  97. return t
  98. end
  99.  
  100. --Creating fake input objects with fake variables
  101. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  102. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  103. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  104. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  105. end}
  106. --Merged 2 functions into one by checking amount of arguments
  107. CAS.UnbindAction = CAS.BindAction
  108.  
  109. --This function will trigger the events that have been :Connect()'ed
  110. local function te(self,ev,...)
  111. local t = m[ev]
  112. if t and t._fakeEvent and t.Function then
  113. t.Function(...)
  114. end
  115. end
  116. m.TrigEvent = te
  117. UIS.TrigEvent = te
  118.  
  119. Event.OnServerEvent:Connect(function(plr,io)
  120. if plr~=Player then return end
  121. if io.isMouse then
  122. m.Target = io.Target
  123. m.Hit = io.Hit
  124. else
  125. local b = io.UserInputState == Enum.UserInputState.Begin
  126. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  127. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  128. end
  129. for _,t in pairs(CAS.Actions) do
  130. for _,k in pairs(t.Keys) do
  131. if k==io.KeyCode then
  132. t.Function(t.Name,io.UserInputState,io)
  133. end
  134. end
  135. end
  136. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  137. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  138. end
  139. end)
  140. Event.Parent = NLS([==[
  141. local Player = game:GetService("Players").LocalPlayer
  142. local Event = script:WaitForChild("UserInput_Event")
  143.  
  144. local UIS = game:GetService("UserInputService")
  145. local input = function(io,a)
  146. if a then return end
  147. --Since InputObject is a client-side instance, we create and pass table instead
  148. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  149. end
  150. UIS.InputBegan:Connect(input)
  151. UIS.InputEnded:Connect(input)
  152.  
  153. local Mouse = Player:GetMouse()
  154. local h,t
  155. --Give the server mouse data 30 times every second, but only if the values changed
  156. --If player is not moving their mouse, client won't fire events
  157. while wait(1/30) do
  158. if h~=Mouse.Hit or t~=Mouse.Target then
  159. h,t=Mouse.Hit,Mouse.Target
  160. Event:FireServer({isMouse=true,Target=t,Hit=h})
  161. end
  162. end]==],Player.Character)
  163. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  164. end
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174. --PortalGun--
  175.  
  176. plr=owner
  177. tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint 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