Advertisement
-----------------

Rick And Morty Portal Gun FE

Feb 8th, 2020
1,821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.49 KB | None | 0 0
  1.  
  2. -- Had to --https://github.com/Mokiros/roblox-FE-compatibility
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,game,owner = owner,game
  5. local RealPlayer = Player
  6. do
  7. print("FE Compatibility code V2 by Mokiros")
  8. local RealPlayer = RealPlayer
  9. script.Parent = RealPlayer.Character
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local Disconnect_Function = function(this)
  13. this[1].Functions[this[2]] = nil
  14. end
  15. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  16. local FakeEvent_Metatable = {__index={
  17. Connect = function(this,f)
  18. local i = tostring(math.random(0,10000))
  19. while this.Functions[i] do
  20. i = tostring(math.random(0,10000))
  21. end
  22. this.Functions[i] = f
  23. return setmetatable({this,i},Disconnect_Metatable)
  24. end
  25. }}
  26. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  27. local function fakeEvent()
  28. return setmetatable({Functions={}},FakeEvent_Metatable)
  29. end
  30.  
  31. --Creating fake input objects with fake variables
  32. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  33. FakeMouse.keyUp = FakeMouse.KeyUp
  34. FakeMouse.keyDown = FakeMouse.KeyDown
  35. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  36. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  37. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  38. end}
  39. --Merged 2 functions into one by checking amount of arguments
  40. CAS.UnbindAction = CAS.BindAction
  41.  
  42. --This function will trigger the events that have been :Connect()'ed
  43. local function TriggerEvent(self,ev,...)
  44. for _,f in pairs(self[ev].Functions) do
  45. f(...)
  46. end
  47. end
  48. FakeMouse.TriggerEvent = TriggerEvent
  49. UIS.TriggerEvent = TriggerEvent
  50.  
  51. --Client communication
  52. local Event = Instance.new("RemoteEvent")
  53. Event.Name = "UserInput_Event"
  54. Event.OnServerEvent:Connect(function(plr,io)
  55. if plr~=RealPlayer then return end
  56. FakeMouse.Target = io.Target
  57. FakeMouse.Hit = io.Hit
  58. if not io.isMouse then
  59. local b = io.UserInputState == Enum.UserInputState.Begin
  60. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  61. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  62. end
  63. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  64. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  65. end
  66. for _,t in pairs(CAS.Actions) do
  67. for _,k in pairs(t.Keys) do
  68. if k==io.KeyCode then
  69. t.Function(t.Name,io.UserInputState,io)
  70. end
  71. end
  72. end
  73. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  74. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  75. end
  76. end)
  77. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  78. local Mouse = owner:GetMouse()
  79. local UIS = game:GetService("UserInputService")
  80. local input = function(io,RobloxHandled)
  81. if RobloxHandled then return end
  82. --Since InputObject is a client-side instance, we create and pass table instead
  83. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  84. end
  85. UIS.InputBegan:Connect(input)
  86. UIS.InputEnded:Connect(input)
  87.  
  88. local h,t
  89. --Give the server mouse data every second frame, but only if the values changed
  90. --If player is not moving their mouse, client won't fire events
  91. local HB = game:GetService("RunService").Heartbeat
  92. while true do
  93. if h~=Mouse.Hit or t~=Mouse.Target then
  94. h,t=Mouse.Hit,Mouse.Target
  95. Event:FireServer({isMouse=true,Target=t,Hit=h})
  96. end
  97. --Wait 2 frames
  98. for i=1,2 do
  99. HB:Wait()
  100. end
  101. end]==],script)
  102.  
  103. ----Sandboxed game object that allows the usage of client-side methods and services
  104. --Real game object
  105. local RealGame = game
  106.  
  107. --Metatable for fake service
  108. local FakeService_Metatable = {
  109. __index = function(self,k)
  110. local s = rawget(self,"_RealService")
  111. if s then
  112. return typeof(s[k])=="function"
  113. and function(_,...)return s[k](s,...)end or s[k]
  114. end
  115. end,
  116. __newindex = function(self,k,v)
  117. local s = rawget(self,"_RealService")
  118. if s then s[k]=v end
  119. end
  120. }
  121. local function FakeService(t,RealService)
  122. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  123. return setmetatable(t,FakeService_Metatable)
  124. end
  125.  
  126. --Fake game object
  127. local FakeGame = {
  128. GetService = function(self,s)
  129. return rawget(self,s) or RealGame:GetService(s)
  130. end,
  131. Players = FakeService({
  132. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  133. },"Players"),
  134. UserInputService = FakeService(UIS,"UserInputService"),
  135. ContextActionService = FakeService(CAS,"ContextActionService"),
  136. RunService = FakeService({
  137. _btrs = {},
  138. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  139. BindToRenderStep = function(self,name,_,fun)
  140. self._btrs[name] = self.Heartbeat:Connect(fun)
  141. end,
  142. UnbindFromRenderStep = function(self,name)
  143. self._btrs[name]:Disconnect()
  144. end,
  145. },"RunService")
  146. }
  147. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  148. FakeGame.service = FakeGame.GetService
  149. FakeService(FakeGame,game)
  150. --Changing owner to fake player object to support owner:GetMouse()
  151. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  152. end
  153. use Inferno as a base though, bit lazy to start from complete scratch --
  154. -- [ Rick & Morty!] --
  155. wait()
  156. LoudVolume = false
  157. Submerged = false
  158. Music = true
  159. script.Name = "Rick" -- or Morty.
  160. Player = game.Players.LocalPlayer
  161. c = game.Players.LocalPlayer.Character
  162. Head = c.Head
  163. anim = c.Humanoid.Animator
  164. Humanoid = c:findFirstChild("Humanoid")Humanoid.Name = "InfiniteBeing"
  165. b23 = Instance.new("BoolValue",c)b23.Name = "InfiniteHuman"
  166. rage = false
  167. p = game.Players.LocalPlayer
  168. s = Instance.new("Sound",c.Head)
  169. s.Name = "Rick&MortyMusic"
  170. s.SoundId = "rbxassetid://888185977"
  171. s.Pitch = 1
  172. if LoudVolume == true then s.Volume = 6 else s.Volume = 1 end
  173. s.Looped = true
  174. wait(0.1)
  175. s:play()
  176. Music = false
  177.  
  178. local Effects = {}
  179. attack = false
  180. local attacking = false
  181. vt = Vector3.new
  182. bc = BrickColor.new
  183. br = BrickColor.random
  184. it = Instance.new
  185. cf = CFrame.new
  186. euler = CFrame.fromEulerAnglesXYZ
  187. angles = CFrame.Angles
  188. matr = math.random
  189. mouse = Player:GetMouse()
  190.  
  191. RSC0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  192. RSC1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  193. LSC0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  194. LSC1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  195. RHC0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  196. RHC1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  197. LHC0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  198. LHC1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  199. NC0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  200. NC1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  201. RJC0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  202. RJC1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  203. RS = c.Torso:FindFirstChild("Right Shoulder")
  204. LS = c.Torso:FindFirstChild("Left Shoulder")
  205. RH = c.Torso:FindFirstChild("Right Hip")
  206. LH = c.Torso:FindFirstChild("Left Hip")
  207. RJ = c.HumanoidRootPart:FindFirstChild("RootJoint")
  208. N = c.Torso:FindFirstChild("Neck")
  209. cf = CFrame.new
  210. ang = CFrame.Angles
  211. rd = math.rad
  212. rd2 = math.random
  213.  
  214.  
  215. function swait(num)
  216. if num==0 or num==nil then
  217. game:service'RunService'.Heartbeat:wait(0)
  218. else
  219. for i=0,num do
  220. game:service'RunService'.Heartbeat:wait(0)
  221. end
  222. end
  223. end
  224.  
  225. function lerpz(joint, prop, cfrmz, alp)
  226. joint[prop] = joint[prop]:lerp(cfrmz, alp)
  227. end
  228. function resetlerp()
  229. RJ.C0 = RJC0
  230. RJ.C1 = RJC1
  231. N.C0 = NC0
  232. N.C1 = NC1
  233. RS.C0 = RSC0
  234. RS.C1 = RSC1
  235. LS.C0 = LSC0
  236. LS.C1 = LSC1
  237. RH.C0 = RHC0
  238. RH.C1 = RHC1
  239. LH.C0 = LHC0
  240. LH.C1 = LHC1
  241. end
  242.  
  243. New = function(Object, Parent, Name, Data)
  244. local Object = Instance.new(Object)
  245. for Index, Value in pairs(Data or {}) do
  246. Object[Index] = Value
  247. end
  248. Object.Parent = Parent
  249. Object.Name = Name
  250. return Object
  251. end
  252. -- Les Build a Portal gun shall we?"
  253. function CreatePortalGun()
  254. if c:findFirstChild("PortalGun") == nil then
  255. local m = Instance.new("Model",c)m.Name = "PortalGun"
  256. local P = Instance.new("Part",m)P.Size = Vector3.new(0.6,1,0.4)P.CanCollide = false P.Material = "SmoothPlastic" P.Name = "Base"
  257. local W = Instance.new("Weld",P)W.Part0 = P W.Part1 = c["Right Arm"] W.C0 = CFrame.new(0,1.6,0.6)W.Name = "GunWeld"
  258. local P2 = Instance.new("Part",m)P2.Size = Vector3.new(0.2,0.8,0.2)P2.Material = "SmoothPlastic" P2.Name = "Handle" P2.CanCollide = false
  259. local W2 = Instance.new("Weld",P2)W2.Part0 = P2 W2.Part1 = P W2.C0 = CFrame.new(0,-0.5,0.15)*CFrame.Angles(math.rad(-30),0,0)
  260. local P3 = Instance.new("Part",m)P3.Size = Vector3.new(0.55,0.4,0.2)P3.CanCollide = false P3.Material = "Neon" P3.Name = "FrontLight"
  261. local W3 = Instance.new("Weld",P3)W3.Part0 = P3 W3.Part1 = P W3.C0 = CFrame.new(0,0.31,0)P3.BrickColor = BrickColor.new("Bright green")
  262. local P4 = Instance.new("Part",m)P4.Size = Vector3.new(0.2,0.2,0.4)P4.CanCollide = false P4.Material = "Neon" P4.Name = "TopLight" P4.Transparency = 0.5
  263. local W4 = Instance.new("Weld",P4)W4.Part0 = P4 W4.Part1 = P W4.C0 = CFrame.new(0,0,0.35)P4.BrickColor = BrickColor.new("Bright green")
  264. local P5 = Instance.new("Part",m)P5.Size = Vector3.new(0.25,0.25,0.45)P5.CanCollide = false P5.Material = "Neon" P5.Name = "TopLight" P5.Transparency = 0.5
  265. local W5 = Instance.new("Weld",P5)W5.Part0 = P5 W5.Part1 = P4 P5.BrickColor = BrickColor.new("Bright green")
  266. local P5 = Instance.new("Part",m)P5.Size = Vector3.new(0.3,0.3,0.2)P5.CanCollide = false P5.Material = "SmoothPlastic" P5.Name = "LowerLight"
  267. local W5 = Instance.new("Weld",P5)W5.Part0 = P5 W5.Part1 = P4 W5.C0 = CFrame.new(0,0,-0.15)
  268. local P5 = Instance.new("Part",m)P5.Size = Vector3.new(0.3,0.2,0.2)P5.CanCollide = false P5.Material = "SmoothPlastic" P5.Name = "Button"
  269. local W5 = Instance.new("Weld",P5)W5.Part0 = P5 W5.Part1 = P4 W5.C0 = CFrame.new(0,-0.3,-0.2) P5.BrickColor = BrickColor.new("Bright red")
  270. local B = Instance.new("BlockMesh",P5)B.Scale = Vector3.new(1,0.75,0.75)
  271. for i,v in pairs (m:children()) do
  272. if v.ClassName == "Part" then
  273. v.TopSurface = "SmoothNoOutlines"
  274. v.BottomSurface = "SmoothNoOutlines"
  275. v.BackSurface = "SmoothNoOutlines"
  276. v.Front = "SmoothNoOutlines"
  277. v.LeftSurface = "SmoothNoOutlines"
  278. v.RightSurface = "SmoothNoOutlines"
  279. end
  280. end
  281. end
  282. end
  283. function ThrowGun()
  284. if c:findFirstChild("PortalGun")~=nil then
  285. anim.Parent = nil
  286. local gun = c:findFirstChild("PortalGun") gun.Parent = game.Workspace
  287. for i = 1,14 do
  288. swait()
  289. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(65)), 0.25)
  290. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(-65)), 0.25)
  291. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(65), rd(90)), 0.25)
  292. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  293. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  294. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  295. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  296. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  297. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  298. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  299. end
  300. gun.Base.GunWeld:remove()
  301. local BV = Instance.new("BodyVelocity",gun.Base)BV.Velocity = c.HumanoidRootPart.CFrame.lookVector*50 game.Debris:AddItem(BV,0.1)
  302. for i = 1,14 do
  303. swait()
  304. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(-65)), 0.25)
  305. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(65)), 0.25)
  306. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(-65), rd(90)), 0.25)
  307. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  308. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  309. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  310. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  311. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  312. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  313. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  314. end
  315. for i = 1,14 do
  316. swait()
  317. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  318. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  319. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  320. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  321. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  322. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  323. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  324. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  325. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  326. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  327. end
  328. resetlerp()
  329. anim.Parent = Humanoid
  330. end
  331. end
  332. -- ;-; --
  333. function PortalRipple(Portalz, Colorz)
  334. if Portalz == nil then return end
  335. local Portal = Instance.new("Part",game.Workspace)Portal.Transparency = 1 Portal.Anchored = true Portal.CanCollide = false Portal.BrickColor = Colorz Portal.Name = "PortalEnergy"
  336. Portal.CFrame = Portalz.CFrame Portal.Size = Vector3.new(0.25,0.45,0.55) Portal.Material = "Neon" local M = Instance.new("SpecialMesh",Portal)M.MeshType = "Sphere"
  337. Spawn(function()
  338. Portal.Transparency = 0.5
  339. for i = 1,20 do
  340. Portal.Transparency = Portal.Transparency + 0.025
  341. Portal.Size = Portal.Size + Vector3.new(0.39,0.54,-0.01)
  342. Portal.CFrame = Portalz.CFrame
  343. swait()
  344. end
  345. Portal:remove()
  346. end)
  347. end
  348. function CreatePortal1()
  349. Spawn(function()
  350. local Portal = Instance.new("Part",game.Workspace)Portal.Transparency = 1 Portal.Anchored = true Portal.CanCollide = false Portal.BrickColor = BrickColor.new("Lime green")
  351. Portal.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,0,-10)Portal.Size = Vector3.new(0.2,0.4,0.2) Portal.Material = "Neon"
  352. local S = Instance.new("Sound", Portal)S.SoundId = "rbxassetid://181004957" S:Play()
  353. if LoudVolume == true then S.Volume = 10 else S.Volume = 2 end
  354. local M = Instance.new("SpecialMesh",Portal)M.MeshType = "Sphere" Portal.Name = "PortalEnergy"
  355. local Portal2 = Instance.new("Part",game.Workspace)Portal2.Transparency = 1 Portal2.Anchored = true Portal2.CanCollide = false Portal2.BrickColor = BrickColor.new("Parsley green")
  356. Portal2.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,0,-10)Portal2.Size = Vector3.new(0.2,0.4,0.2) Portal2.Material = "Neon"
  357. local PosP = Portal.CFrame
  358. local M = Instance.new("SpecialMesh",Portal2)M.MeshType = "Sphere" Portal2.Name = "PortalEnergy"
  359. for i = 1,10 do
  360. Portal.Transparency = Portal.Transparency - 0.25
  361. Portal.Size = Portal.Size + Vector3.new(0.65,0.95,0)
  362. Portal.CFrame = PosP
  363. Portal2.Transparency = Portal2.Transparency - 0.25
  364. Portal2.Size = Portal2.Size + Vector3.new(0.63,0.93,0.005)
  365. Portal2.CFrame = PosP
  366. swait()
  367. end
  368. Portal.Touched:connect(function(PartH)
  369. if PartH.Parent ~= c and PartH.Parent.Parent ~= c and PartH.Size.Z <= 200 and PartH.Name ~= "PortalEnergy" then
  370. PartH:remove()
  371. end
  372. end)
  373. local R = 1
  374. for i = 1,100 do
  375. wait(0.1)
  376. if R == 1 then R = 2
  377. PortalRipple(Portal2,BrickColor.new("Earth green"))
  378. elseif R == 2 then R = 1
  379. PortalRipple(Portal2,BrickColor.new("Lime green"))
  380. elseif R == 3 then R = 4
  381. PortalRipple(Portal2,BrickColor.new("Earth green"))
  382. elseif R == 4 then R = 1
  383. PortalRipple(Portal2,BrickColor.new("Lime green"))
  384. end
  385. end
  386. for i = 1,10 do
  387. Portal.Transparency = Portal.Transparency + 0.25
  388. Portal.Size = Portal.Size - Vector3.new(0.65,0.95,0)
  389. Portal.CFrame = PosP
  390. Portal2.Transparency = Portal2.Transparency + 0.25
  391. Portal2.Size = Portal2.Size - Vector3.new(0.63,0.93,0.005)
  392. Portal2.CFrame = PosP
  393. swait()
  394. end
  395. end)
  396. end
  397.  
  398. function CreatePortal2()
  399. Spawn(function()
  400. local Portal = Instance.new("Part",game.Workspace)Portal.Transparency = 1 Portal.Anchored = true Portal.CanCollide = false Portal.BrickColor = BrickColor.new("Lime green")
  401. Portal.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,-3,0)*CFrame.Angles(math.rad(-90),0,0)Portal.Size = Vector3.new(0.2,0.4,0.2) Portal.Material = "Neon"
  402. local M = Instance.new("SpecialMesh",Portal)M.MeshType = "Sphere" Portal.Name = "PortalEnergy"
  403. local S = Instance.new("Sound", Portal)S.SoundId = "rbxassetid://477163697" S:Play()
  404. if LoudVolume == true then S.Volume = 10 else S.Volume = 2 end
  405. local Portal2 = Instance.new("Part",game.Workspace)Portal2.Transparency = 1 Portal2.Anchored = true Portal2.CanCollide = false Portal2.BrickColor = BrickColor.new("Parsley green")
  406. Portal2.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,-3,0)*CFrame.Angles(math.rad(-90),0,0)Portal2.Size = Vector3.new(0.2,0.4,0.2) Portal2.Material = "Neon"
  407. local PosP = Portal.CFrame
  408. local M = Instance.new("SpecialMesh",Portal2)M.MeshType = "Sphere" Portal2.Name = "PortalEnergy"
  409. for i = 1,10 do
  410. Portal.Transparency = Portal.Transparency - 0.25
  411. Portal.Size = Portal.Size + Vector3.new(0.65,0.95,0)
  412. Portal.CFrame = PosP
  413. Portal2.Transparency = Portal2.Transparency - 0.25
  414. Portal2.Size = Portal2.Size + Vector3.new(0.63,0.93,0.005)
  415. Portal2.CFrame = PosP
  416. swait()
  417. end
  418. for i = 1,10 do
  419. Portal.Transparency = Portal.Transparency + 0.25
  420. Portal.Size = Portal.Size - Vector3.new(0.65,0.95,0)
  421. Portal.CFrame = PosP
  422. Portal2.Transparency = Portal2.Transparency + 0.25
  423. Portal2.Size = Portal2.Size - Vector3.new(0.63,0.93,0.005)
  424. Portal2.CFrame = PosP
  425. swait()
  426. end
  427. end)
  428. end
  429.  
  430. function CreatePortal3()
  431. Spawn(function()
  432. local Portal = Instance.new("Part",game.Workspace)Portal.Transparency = 1 Portal.Anchored = true Portal.CanCollide = false Portal.BrickColor = BrickColor.new("Lime green")
  433. Portal.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,10,0)*CFrame.Angles(math.rad(-90),0,0)Portal.Size = Vector3.new(0.2,0.4,0.2) Portal.Material = "Neon"
  434. local M = Instance.new("SpecialMesh",Portal)M.MeshType = "Sphere" Portal.Name = "PortalEnergy"
  435. local Portal2 = Instance.new("Part",game.Workspace)Portal2.Transparency = 1 Portal2.Anchored = true Portal2.CanCollide = false Portal2.BrickColor = BrickColor.new("Parsley green")
  436. Portal2.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,10,0)*CFrame.Angles(math.rad(-90),0,0)Portal2.Size = Vector3.new(0.2,0.4,0.2) Portal2.Material = "Neon"
  437. local PosP = Portal.CFrame
  438. local M = Instance.new("SpecialMesh",Portal2)M.MeshType = "Sphere" Portal2.Name = "PortalEnergy"
  439. local S = Instance.new("Sound", Portal)S.SoundId = "rbxassetid://181004957" S:Play()
  440. if LoudVolume == true then S.Volume = 10 else S.Volume = 2 end
  441. for i = 1,10 do
  442. Portal.Transparency = Portal.Transparency - 0.25
  443. Portal.Size = Portal.Size + Vector3.new(0.65,0.95,0)
  444. Portal.CFrame = PosP
  445. Portal2.Transparency = Portal2.Transparency - 0.25
  446. Portal2.Size = Portal2.Size + Vector3.new(0.63,0.93,0.005)
  447. Portal2.CFrame = PosP
  448. swait()
  449. end
  450. for i = 1,10 do
  451. Portal.Transparency = Portal.Transparency + 0.25
  452. Portal.Size = Portal.Size - Vector3.new(0.65,0.95,0)
  453. Portal.CFrame = PosP
  454. Portal2.Transparency = Portal2.Transparency + 0.25
  455. Portal2.Size = Portal2.Size - Vector3.new(0.63,0.93,0.005)
  456. Portal2.CFrame = PosP
  457. swait()
  458. end
  459. end)
  460. end
  461.  
  462. function DestructionPortal()
  463. attack = true
  464. anim.Parent = nil
  465. for i = 1,14 do
  466. swait()
  467. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(65)), 0.25)
  468. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(-65)), 0.25)
  469. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(-65), rd(90)), 0.25)
  470. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  471. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  472. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  473. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  474. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  475. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  476. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  477. end
  478. for i = 1,6 do
  479. swait()
  480. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(65)), 0.35)
  481. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(-65)), 0.35)
  482. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(-65), rd(125)), 0.35)
  483. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  484. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  485. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  486. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  487. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  488. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  489. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.35)
  490. end
  491. CreatePortal1()
  492. for i = 1,10 do
  493. swait()
  494. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(65)), 0.25)
  495. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(-65)), 0.25)
  496. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(-65), rd(90)), 0.25)
  497. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  498. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  499. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  500. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  501. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  502. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  503. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  504. end
  505. for i = 1,10 do
  506. swait()
  507. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  508. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  509. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  510. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  511. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  512. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  513. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  514. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  515. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  516. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  517. end
  518. resetlerp()
  519. attack = false
  520. anim.Parent = Humanoid
  521. end
  522. Disappeared = false
  523. function DisappearPortal()
  524. if Disappeared == false then
  525. attack = true Humanoid.WalkSpeed = 150 Humanoid.JumpPower = 250
  526. Disappeared = true
  527. anim.Parent = nil
  528. for i = 1,14 do
  529. swait()
  530. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  531. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(45), rd(0), rd(0)), 0.25)
  532. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(15), rd(0), rd(15)), 0.25)
  533. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  534. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  535. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  536. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  537. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  538. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  539. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  540. end
  541. for i = 1,8 do
  542. swait()
  543. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  544. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(45), rd(0), rd(0)), 0.5)
  545. lerpz(RS, "C0", RSC0 * cf(0, 0.5, 0) * ang(rd(15), rd(0), rd(15)), 0.5)
  546. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  547. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  548. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  549. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  550. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  551. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  552. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.5)
  553. end
  554. CreatePortal2()
  555. for i = 1,14 do
  556. swait()
  557. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  558. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(45), rd(0), rd(0)), 0.25)
  559. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(15), rd(0), rd(15)), 0.25)
  560. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  561. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  562. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  563. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  564. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  565. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  566. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  567. end
  568. lerpz(RJ, "C0", RJC0 * cf(0, 0, 1000000) * ang(rd(0), rd(0), rd(0)), 1)
  569. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(45), rd(0), rd(0)), 1)
  570. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(15), rd(0), rd(15)), 1)
  571. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  572. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  573. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  574. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  575. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  576. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  577. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 1)
  578. attack = false
  579. anim.Parent = Humanoid
  580. else Disappeared = false
  581. resetlerp() Humanoid.WalkSpeed = 16 Humanoid.JumpPower = 50
  582. CreatePortal3() wait()
  583. c.HumanoidRootPart.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,10,0)
  584. end
  585. end
  586.  
  587. function EpicLaugh()
  588. for i = 1,5 do
  589. local S = Instance.new("Sound",c.Head)S.SoundId = "rbxassetid://207358216" S.Volume = 10 S:Play()
  590. end
  591. for i = 1,35 do
  592. swait()
  593. lerpz(RJ, "C0", RJC0 * cf(0, 0, 0) * ang(rd(-15), rd(0), rd(0)), 0.25)
  594. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(-15), rd(0), rd(0)), 0.25)
  595. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(-35), rd(0), rd(180)), 0.25)
  596. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  597. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(-35), rd(0), rd(-180)), 0.25)
  598. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  599. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(-15), rd(0), rd(-25)), 0.25)
  600. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  601. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(-15), rd(0), rd(25)), 0.25)
  602. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(0), rd(0), rd(0)), 0.25)
  603. end
  604. for i = 1,100 do
  605. swait()
  606. lerpz(RJ, "C0", RJC0 * cf(0, 0, -2) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  607. lerpz(N, "C0", NC0 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  608. lerpz(RS, "C0", RSC0 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  609. lerpz(RS, "C1", RSC1 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  610. lerpz(LS, "C0", LSC0 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  611. lerpz(LS, "C1", LSC1 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  612. lerpz(RH, "C0", RHC0 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  613. lerpz(RH, "C1", RHC1 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  614. lerpz(LH, "C0", LHC0 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  615. lerpz(LH, "C1", LHC1 * cf(0, 0, 0) * ang(rd(math.random(-360,360)), rd(math.random(-360,360)), rd(math.random(-360,360))), 1)
  616. end
  617. resetlerp()
  618. end
  619.  
  620. function MuteMusic()
  621. if s.Volume > 0 then
  622. s.Volume = 0
  623. else
  624. if LoudVolume == true then
  625. s.Volume = 6
  626. else
  627. s.Volume = 1
  628. end
  629. end
  630. end
  631.  
  632. mouse.KeyDown:connect(function(key)
  633. if attack == true then return end
  634. if c:findFirstChild("PortalGun")~=nil then
  635. if Disappeared == false then
  636. if key == "z" then
  637. DestructionPortal()
  638. end
  639. end
  640. if key == "x" then
  641. DisappearPortal()
  642. end
  643. end
  644. if Disappeared == false then
  645. if key == "q" then
  646. CreatePortalGun()
  647. end
  648. if key == "e" then
  649. ThrowGun()
  650. end
  651. end
  652. if key == "l" then
  653. MuteMusic()
  654. end
  655. if key == "m" then
  656. EpicLaugh()
  657. end
  658. end)
  659.  
  660. game:GetService("RunService").RenderStepped:connect(function()
  661. Humanoid.MaxHealth = Humanoid.MaxHealth*2
  662. Humanoid.Health = Humanoid.MaxHealth*2
  663. for i,v in pairs (c:children()) do
  664. if v.ClassName == "Accessory" then
  665. for i,v2 in pairs (v:children()) do
  666. if v2.ClassName == "Part" then
  667. v2.Anchored = false
  668. end
  669. end
  670. end
  671. end
  672. for i,v in pairs (c:children()) do
  673. if v.ClassName == "Part" then
  674. v.Anchored = false
  675. end
  676. end
  677. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement