Advertisement
EmeraldIT

Memento Wand

Aug 9th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.12 KB | None | 0 0
  1. local asset = LoadAssets(18880416072):GetDictionary()
  2. local memento = asset.Memento
  3. memento.Parent = workspace
  4. asset.Effects.Parent = workspace
  5. asset.DefaultCharacter.Parent = game.ReplicatedStorage
  6. asset.Glint.Parent = game.ReplicatedStorage
  7. tool = asset["Portal Wand"]
  8. tool.Parent = owner.Backpack
  9.  
  10. local TOOLSCRIPT = {"local", [[local Ev = game.ReplicatedStorage:WaitForChild("Effect Event")
  11. local plr = game.Players.LocalPlayer
  12. local mouse = plr:GetMouse()
  13. local enabled = false
  14.  
  15. script.Parent.Activated:Connect(function()
  16. Ev:FireServer({Effect = "Portal", CFrame = CFrame.new(mouse.Hit.p, plr.Character.HumanoidRootPart.Position)})
  17. end)]]}
  18.  
  19. local GoesInDefaultCharacter = {
  20. Animate = {"local", [[
  21. wait(1)
  22. local Figure = script.Parent
  23. local Torso = Figure:WaitForChild("Torso")
  24. local RightShoulder = Torso:WaitForChild("Right Shoulder")
  25. local LeftShoulder = Torso:WaitForChild("Left Shoulder")
  26. local RightHip = Torso:WaitForChild("Right Hip")
  27. local LeftHip = Torso:WaitForChild("Left Hip")
  28. local Neck = Torso:WaitForChild("Neck")
  29. local Humanoid = Figure:WaitForChild("Humanoid")
  30. local pose = "None"
  31.  
  32. local toolAnim = "None"
  33. local toolAnimTime = 0
  34.  
  35. function onRunning(speed)
  36. if Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
  37. pose = "Running"
  38. else
  39. pose = "None"
  40. end
  41. end
  42.  
  43. function onDied()
  44. pose = "Dead"
  45. end
  46.  
  47. function onJumping()
  48. pose = "Jumping"
  49. end
  50.  
  51. function onClimbing()
  52. pose = ("Climbing")
  53. end
  54.  
  55. function onGettingUp()
  56. pose = "GettingUp"
  57. end
  58.  
  59. function onFreeFall()
  60. pose = "FreeFall"
  61. end
  62.  
  63. function onFallingDown()
  64. pose = "FallingDown"
  65. end
  66.  
  67. function onSeated()
  68. pose = "Seated"
  69. end
  70.  
  71. function onPlatformStanding()
  72. pose = "None"
  73. end
  74.  
  75. function moveJump()
  76. RightShoulder.MaxVelocity = 0.5
  77. LeftShoulder.MaxVelocity = 0.5
  78. RightShoulder.DesiredAngle = 3.14
  79. LeftShoulder.DesiredAngle = -3.14
  80. RightHip.DesiredAngle = 0
  81. LeftHip.DesiredAngle = 0
  82. end
  83.  
  84. function moveFreeFall()
  85. RightShoulder.MaxVelocity = 0.5
  86. LeftShoulder.MaxVelocity = 0.5
  87. RightShoulder.DesiredAngle = 3.14
  88. LeftShoulder.DesiredAngle = -3.14
  89. RightHip.DesiredAngle = 0
  90. LeftHip.DesiredAngle = 0
  91. end
  92.  
  93. function moveSit()
  94. RightShoulder.MaxVelocity = 0.15
  95. LeftShoulder.MaxVelocity = 0.15
  96. RightShoulder.DesiredAngle = 3.14 / 2
  97. LeftShoulder.DesiredAngle = -3.14 / 2
  98. RightHip.DesiredAngle = 3.14 / 2
  99. LeftHip.DesiredAngle = -3.14 / 2
  100. end
  101.  
  102. function getTool()
  103. for _, kid in ipairs(Figure:GetChildren()) do
  104. if kid.className == "Tool" then
  105. return kid
  106. end
  107. end
  108. return nil
  109. end
  110.  
  111. function getToolAnim(tool)
  112. for _, c in ipairs(tool:GetChildren()) do
  113. if c.Name == "toolanim" and c.className == "StringValue" then
  114. return c
  115. end
  116. end
  117. return nil
  118. end
  119.  
  120. function animateTool()
  121. if (toolAnim == "None") then
  122. RightShoulder.DesiredAngle = 1.57
  123. end
  124.  
  125. if (toolAnim == "Slash") then
  126. RightShoulder.MaxVelocity = 0.5
  127. RightShoulder.DesiredAngle = 0
  128. return
  129. end
  130.  
  131. if (toolAnim == "Lunge") then
  132. RightShoulder.MaxVelocity = 0.5
  133. LeftShoulder.MaxVelocity = 0.5
  134. RightHip.MaxVelocity = 0.5
  135. LeftHip.MaxVelocity = 0.5
  136. RightShoulder.DesiredAngle = 1.57
  137. LeftShoulder.DesiredAngle = 1.0
  138. RightHip.DesiredAngle = 1.57
  139. LeftHip.DesiredAngle = 1.0
  140. return
  141. end
  142. end
  143.  
  144. function move()
  145. local amplitude
  146. local frequency
  147.  
  148. if (pose == "Jumping") then
  149. moveJump()
  150. return
  151. end
  152.  
  153. if (pose == "FreeFall") then
  154. moveFreeFall()
  155. return
  156. end
  157.  
  158. if (pose == "Seated") then
  159. moveSit()
  160. return
  161. end
  162.  
  163. local climbFudge = 0
  164.  
  165. if (pose == "Running") then
  166. RightShoulder.MaxVelocity = 0.15
  167. LeftShoulder.MaxVelocity = 0.15
  168. amplitude = 1
  169. frequency = 9
  170. elseif (pose == "Climbing") then
  171. amplitude = 1
  172. frequency = 9
  173. climbFudge = 3.14
  174. RightShoulder.MaxVelocity = 0.5
  175. LeftShoulder.MaxVelocity = 0.5
  176. else
  177. amplitude = 0.1
  178. frequency = 1
  179. end
  180.  
  181. desiredAngle = amplitude * math.sin(time() * frequency)
  182.  
  183. RightShoulder.DesiredAngle = desiredAngle + climbFudge
  184. LeftShoulder.DesiredAngle = desiredAngle - climbFudge
  185. RightHip.DesiredAngle = -desiredAngle
  186. LeftHip.DesiredAngle = -desiredAngle
  187.  
  188. local tool = getTool()
  189.  
  190. if tool and tool.Handle then
  191. animStringValueObject = getToolAnim(tool)
  192.  
  193. if animStringValueObject then
  194. toolAnim = animStringValueObject.Value
  195. animStringValueObject.Parent = nil
  196. toolAnimTime = time() + .3
  197. end
  198.  
  199. if time() > toolAnimTime then
  200. toolAnimTime = 0
  201. toolAnim = "None"
  202. end
  203.  
  204. animateTool()
  205. else
  206. toolAnim = "None"
  207. toolAnimTime = 0
  208. end
  209. end
  210.  
  211. Humanoid.Died:connect(onDied)
  212. Humanoid.Running:connect(onRunning)
  213. Humanoid.Jumping:connect(onJumping)
  214. Humanoid.Climbing:connect(onClimbing)
  215. Humanoid.GettingUp:connect(onGettingUp)
  216. Humanoid.FreeFalling:connect(onFreeFall)
  217. Humanoid.FallingDown:connect(onFallingDown)
  218. Humanoid.Seated:connect(onSeated)
  219. Humanoid.PlatformStanding:connect(onPlatformStanding)
  220.  
  221. local runService = game:service("RunService")
  222.  
  223. game:GetService("RunService").Heartbeat:connect(function()
  224. move()
  225. end)
  226.  
  227. --All sounds are referenced by this ID
  228. local SFX = {
  229. Died = 0;
  230. Running = 1;
  231. Swimming = 2;
  232. Climbing = 3,
  233. Jumping = 4;
  234. GettingUp = 5;
  235. FreeFalling = 6;
  236. FallingDown = 7;
  237. Landing = 8;
  238. Splash = 9;
  239. }
  240.  
  241. local Humanoid = nil
  242. local Head = nil
  243. --SFX ID to Sound object
  244. local Sounds = {}
  245. local SoundService = game:GetService("SoundService")
  246. local soundEventFolderName = "DefaultSoundEvents"
  247. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  248. local AddCharacterLoadedEvent = nil
  249. local RemoveCharacterEvent = nil
  250. local soundEventFolder = ReplicatedStorage:FindFirstChild(soundEventFolderName)
  251.  
  252. if not soundEventFolder then
  253. soundEventFolder = Instance.new("Folder", ReplicatedStorage)
  254. soundEventFolder.Name = soundEventFolderName
  255. soundEventFolder.Archivable = false
  256. end
  257.  
  258. -- Load the RemoveCharacterEvent
  259. RemoveCharacterEvent = soundEventFolder:FindFirstChild("RemoveCharacterEvent")
  260. if RemoveCharacterEvent == nil then
  261. RemoveCharacterEvent = Instance.new("RemoteEvent", soundEventFolder)
  262. RemoveCharacterEvent.Name = "RemoveCharacterEvent"
  263. end
  264.  
  265. AddCharacterLoadedEvent = soundEventFolder:FindFirstChild("AddCharacterLoadedEvent")
  266. if AddCharacterLoadedEvent == nil then
  267. AddCharacterLoadedEvent = Instance.new("RemoteEvent", soundEventFolder)
  268. AddCharacterLoadedEvent.Name = "AddCharacterLoadedEvent"
  269. end
  270.  
  271. -- Notify the server a new character has been loaded
  272. AddCharacterLoadedEvent:FireServer()
  273.  
  274. -- Notify the sound dispatcher this character has left.
  275. game.Players.LocalPlayer.CharacterRemoving:connect(function(character)
  276. RemoveCharacterEvent:FireServer(game.Players.LocalPlayer)
  277. end)
  278.  
  279. do
  280. local Figure = script.Parent.Parent
  281. Head = Figure:WaitForChild("Head")
  282. while not Humanoid do
  283. for _,NewHumanoid in pairs(Figure:GetChildren()) do
  284. if NewHumanoid:IsA("Humanoid") then
  285. Humanoid = NewHumanoid
  286. break
  287. end
  288. end
  289. if Humanoid then break end
  290. Figure.ChildAdded:wait()
  291. end
  292. Sounds[SFX.Died] = Head:WaitForChild("Died")
  293. Sounds[SFX.Running] = Head:WaitForChild("Running")
  294. Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
  295. Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
  296. Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
  297. Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
  298. Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
  299. Sounds[SFX.Landing] = Head:WaitForChild("Landing")
  300. Sounds[SFX.Splash] = Head:WaitForChild("Splash")
  301.  
  302. local DefaultServerSoundEvent = soundEventFolder:FindFirstChild("DefaultServerSoundEvent")
  303.  
  304. if DefaultServerSoundEvent then
  305. DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
  306. if resetPosition and sound.TimePosition ~= 0 then
  307. sound.TimePosition = 0
  308. end
  309. if sound.IsPlaying ~= playing then
  310. sound.Playing = playing
  311. end
  312. end)
  313. end
  314. end
  315.  
  316. local IsSoundFilteringEnabled = function()
  317. return false --game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled
  318. end
  319.  
  320. local Util
  321. Util = {
  322.  
  323. --Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
  324. YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
  325. --(y - y1)/(x - x1) = m
  326. local m = (pt1y - pt2y) / (pt1x - pt2x)
  327. --float b = pt1.y - m * pt1.x;
  328. local b = (pt1y - m * pt1x)
  329. return m * x + b
  330. end;
  331.  
  332. --Clamps the value of "val" between the "min" and "max"
  333. Clamp = function(val,min,max)
  334. return math.min(max,math.max(min,val))
  335. end;
  336.  
  337. --Gets the horizontal (x,z) velocity magnitude of the given part
  338. HorizontalSpeed = function(Head)
  339. local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
  340. return hVel.magnitude
  341. end;
  342.  
  343. --Gets the vertical (y) velocity magnitude of the given part
  344. VerticalSpeed = function(Head)
  345. return math.abs(Head.Velocity.Y)
  346. end;
  347.  
  348. --Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
  349. --If these properties are enabled, use them.
  350. Play = function(sound)
  351. if IsSoundFilteringEnabled() then
  352. sound.CharacterSoundEvent:FireServer(true, true)
  353. end
  354. if sound.TimePosition ~= 0 then
  355. sound.TimePosition = 0
  356. end
  357. if not sound.IsPlaying then
  358. sound.Playing = true
  359. end
  360. end;
  361.  
  362. Pause = function(sound)
  363. if IsSoundFilteringEnabled() then
  364. sound.CharacterSoundEvent:FireServer(false, false)
  365. end
  366. if sound.IsPlaying then
  367. sound.Playing = false
  368. end
  369. end;
  370.  
  371. Resume = function(sound)
  372. if IsSoundFilteringEnabled() then
  373. sound.CharacterSoundEvent:FireServer(true, false)
  374. end
  375. if not sound.IsPlaying then
  376. sound.Playing = true
  377. end
  378. end;
  379.  
  380. Stop = function(sound)
  381. if IsSoundFilteringEnabled() then
  382. sound.CharacterSoundEvent:FireServer(false, true)
  383. end
  384. if sound.IsPlaying then
  385. sound.Playing = false
  386. end
  387. if sound.TimePosition ~= 0 then
  388. sound.TimePosition = 0
  389. end
  390. end;
  391. }
  392.  
  393. do
  394. -- List of all active Looped sounds
  395. local playingLoopedSounds = {}
  396.  
  397. -- Last seen Enum.HumanoidStateType
  398. local activeState = nil
  399.  
  400. local fallSpeed = 0
  401.  
  402. -- Verify and set that "sound" is in "playingLoopedSounds".
  403. function setSoundInPlayingLoopedSounds(sound)
  404. for i=1, #playingLoopedSounds do
  405. if playingLoopedSounds[i] == sound then
  406. return
  407. end
  408. end
  409. table.insert(playingLoopedSounds,sound)
  410. end
  411.  
  412. -- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
  413. function stopPlayingLoopedSoundsExcept(except)
  414. for i=#playingLoopedSounds,1,-1 do
  415. if playingLoopedSounds[i] ~= except then
  416. Util.Pause(playingLoopedSounds[i])
  417. table.remove(playingLoopedSounds,i)
  418. end
  419. end
  420. end
  421.  
  422. -- Table of Enum.HumanoidStateType to handling function
  423. local stateUpdateHandler = {
  424. [Enum.HumanoidStateType.Dead] = function()
  425. stopPlayingLoopedSoundsExcept()
  426. local sound = Sounds[SFX.Died]
  427. Util.Play(sound)
  428. end;
  429.  
  430. [Enum.HumanoidStateType.RunningNoPhysics] = function(speed)
  431. stateUpdated(Enum.HumanoidStateType.Running, speed)
  432. end;
  433.  
  434. [Enum.HumanoidStateType.Running] = function(speed)
  435. local sound = Sounds[SFX.Running]
  436. stopPlayingLoopedSoundsExcept(sound)
  437.  
  438. if(activeState == Enum.HumanoidStateType.Freefall and fallSpeed > 0.1) then
  439. -- Play a landing sound if the character dropped from a large distance
  440. local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
  441. local freeFallSound = Sounds[SFX.FreeFalling]
  442. freeFallSound.Volume = vol
  443. Util.Play(freeFallSound)
  444. fallSpeed = 0
  445. end
  446. if speed ~= nil and speed > 0.5 then
  447. Util.Resume(sound)
  448. setSoundInPlayingLoopedSounds(sound)
  449. elseif speed ~= nil then
  450. stopPlayingLoopedSoundsExcept()
  451. end
  452. end;
  453.  
  454. [Enum.HumanoidStateType.Swimming] = function(speed)
  455. local threshold = speed
  456. if activeState ~= Enum.HumanoidStateType.Swimming and threshold > 0.1 then
  457. local splashSound = Sounds[SFX.Splash]
  458. splashSound.Volume = Util.Clamp(
  459. Util.YForLineGivenXAndTwoPts(
  460. Util.VerticalSpeed(Head),
  461. 100, 0.28,
  462. 350, 1),
  463. 0,1)
  464. Util.Play(splashSound)
  465. end
  466.  
  467. do
  468. local sound = Sounds[SFX.Swimming]
  469. stopPlayingLoopedSoundsExcept(sound)
  470. Util.Resume(sound)
  471. setSoundInPlayingLoopedSounds(sound)
  472. end
  473. end;
  474.  
  475. [Enum.HumanoidStateType.Climbing] = function(speed)
  476. local sound = Sounds[SFX.Climbing]
  477. if speed ~= nil and math.abs(speed) > 0.1 then
  478. Util.Resume(sound)
  479. stopPlayingLoopedSoundsExcept(sound)
  480. else
  481. Util.Pause(sound)
  482. stopPlayingLoopedSoundsExcept(sound)
  483. end
  484.  
  485. setSoundInPlayingLoopedSounds(sound)
  486. end;
  487.  
  488. [Enum.HumanoidStateType.Jumping] = function()
  489. if activeState == Enum.HumanoidStateType.Jumping then
  490. return
  491. end
  492. stopPlayingLoopedSoundsExcept()
  493. local sound = Sounds[SFX.Jumping]
  494. Util.Play(sound)
  495. end;
  496.  
  497. [Enum.HumanoidStateType.GettingUp] = function()
  498. stopPlayingLoopedSoundsExcept()
  499. local sound = Sounds[SFX.GettingUp]
  500. Util.Play(sound)
  501. end;
  502.  
  503. [Enum.HumanoidStateType.Freefall] = function()
  504. if activeState == Enum.HumanoidStateType.Freefall then
  505. return
  506. end
  507. local sound = Sounds[SFX.FreeFalling]
  508. sound.Volume = 0
  509. stopPlayingLoopedSoundsExcept()
  510.  
  511. fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.y))
  512. end;
  513.  
  514. [Enum.HumanoidStateType.FallingDown] = function()
  515. stopPlayingLoopedSoundsExcept()
  516. end;
  517.  
  518. [Enum.HumanoidStateType.Landed] = function()
  519. stopPlayingLoopedSoundsExcept()
  520. if Util.VerticalSpeed(Head) > 75 then
  521. local landingSound = Sounds[SFX.Landing]
  522. landingSound.Volume = Util.Clamp(
  523. Util.YForLineGivenXAndTwoPts(
  524. Util.VerticalSpeed(Head),
  525. 50, 0,
  526. 100, 1),
  527. 0,1)
  528. Util.Play(landingSound)
  529. end
  530. end;
  531.  
  532. [Enum.HumanoidStateType.Seated] = function()
  533. stopPlayingLoopedSoundsExcept()
  534. end;
  535. }
  536.  
  537.  
  538.  
  539. -- Handle state event fired or OnChange fired
  540. function stateUpdated(state, speed)
  541. if stateUpdateHandler[state] ~= nil then
  542. if (state == Enum.HumanoidStateType.Running
  543. or state == Enum.HumanoidStateType.Climbing
  544. or state == Enum.HumanoidStateType.Swimming
  545. or state == Enum.HumanoidStateType.RunningNoPhysics) then
  546. stateUpdateHandler[state](speed)
  547. else
  548. stateUpdateHandler[state]()
  549. end
  550. end
  551. activeState = state
  552. end
  553.  
  554. Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
  555. Humanoid.Running:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Running, speed) end)
  556. Humanoid.Swimming:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Swimming, speed) end)
  557. Humanoid.Climbing:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Climbing, speed) end)
  558. Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
  559. Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
  560. Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
  561. Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
  562.  
  563.  
  564.  
  565. -- required for proper handling of Landed event
  566.  
  567. Humanoid.StateChanged:connect(function(old, new)
  568. stateUpdated(new)
  569. end)
  570.  
  571.  
  572.  
  573. function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
  574. local stepScale = stepDeltaSeconds / tickSpeedSeconds
  575. do
  576. local sound = Sounds[SFX.FreeFalling]
  577. if activeState == Enum.HumanoidStateType.Freefall then
  578. if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
  579. Util.Resume(sound)
  580.  
  581. --Volume takes 1.1 seconds to go from volume 0 to 1
  582. local ANIMATION_LENGTH_SECONDS = 1.1
  583.  
  584. local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
  585. sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
  586. else
  587. sound.Volume = 0
  588. end
  589. else
  590. Util.Pause(sound)
  591. end
  592. end
  593.  
  594. do
  595. local sound = Sounds[SFX.Running]
  596. if activeState == Enum.HumanoidStateType.Running then
  597. if Util.HorizontalSpeed(Head) < 0.5 then
  598. Util.Pause(sound)
  599. end
  600. end
  601. end
  602. end
  603.  
  604.  
  605. local lastTick = tick()
  606. local TICK_SPEED_SECONDS = 0.25
  607. while true do
  608. onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
  609. lastTick = tick()
  610. wait(TICK_SPEED_SECONDS)
  611. end
  612.  
  613. end
  614.  
  615. ]]},
  616.  
  617. Health = {"server", [[
  618. local Character = script.Parent
  619. local Humanoid = Character:WaitForChild("Humanoid")
  620.  
  621. while true do
  622. if Humanoid.Health < Humanoid.MaxHealth then
  623. Humanoid.Health = math.min(Humanoid.Health + 0.1*Humanoid.MaxHealth, Humanoid.MaxHealth)
  624. wait(1)
  625. end
  626. Humanoid.HealthChanged:Wait()
  627. end]]},
  628.  
  629. Sound = {
  630. "server",
  631. [[
  632. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  633. local Players = game:GetService("Players")
  634.  
  635. local SOUND_EVENT_FOLDER_NAME = "DefaultSoundEvents"
  636. local DEFAULT_SERVER_SOUND_EVENT_NAME = "DefaultServerSoundEvent"
  637.  
  638. local SoundEventFolder = ReplicatedStorage:FindFirstChild(SOUND_EVENT_FOLDER_NAME)
  639. local DefaultServerSoundEvent = nil
  640.  
  641. if not SoundEventFolder then
  642. SoundEventFolder = Instance.new("Folder")
  643. SoundEventFolder.Name = SOUND_EVENT_FOLDER_NAME
  644. SoundEventFolder.Archivable = false
  645. SoundEventFolder.Parent = ReplicatedStorage
  646. end
  647.  
  648. DefaultServerSoundEvent = SoundEventFolder:FindFirstChild(DEFAULT_SERVER_SOUND_EVENT_NAME)
  649.  
  650. if not DefaultServerSoundEvent then
  651. DefaultServerSoundEvent = Instance.new("RemoteEvent", SoundEventFolder)
  652.  
  653. DefaultServerSoundEvent.Name = DEFAULT_SERVER_SOUND_EVENT_NAME
  654. DefaultServerSoundEvent.OnServerEvent:Connect(function(plr, mm,mmm) print(mm,mmm) end)
  655. end
  656.  
  657. local function CreateNewSound(name, id, looped, pitch, parent)
  658. local sound = Instance.new("Sound")
  659. sound.SoundId = id
  660. sound.Name = name
  661. sound.Archivable = false
  662. sound.Pitch = pitch
  663. sound.Looped = looped
  664. sound.MinDistance = 5
  665. sound.MaxDistance = 150
  666. sound.Volume = 0.65
  667. sound.Parent = parent
  668.  
  669. --if DefaultServerSoundEvent then
  670. local CharacterSoundEvent = Instance.new("RemoteEvent", sound)
  671. CharacterSoundEvent.Name = "CharacterSoundEvent"
  672. CharacterSoundEvent.OnServerEvent:Connect(function(player, playing, resetPosition)
  673. if type(playing) ~= "boolean" then
  674. return
  675. end
  676. if type(resetPosition) ~= "boolean" then
  677. return
  678. end
  679.  
  680. if player.Character ~= script.Parent then
  681. return
  682. end
  683. for _, p in pairs(Players:GetPlayers()) do
  684. if p ~= player then
  685. -- Connect to the dispatcher to check if the player has loaded.
  686. SoundEventFolder:FindFirstChild("SoundDispatcher"):Fire(p, sound, playing, resetPosition)
  687. end
  688. end
  689. end)
  690. --end
  691. return sound
  692. end
  693.  
  694. local head = script.Parent:FindFirstChild("Head")
  695. if not head then
  696. error("Sound script parent has no child Head.")
  697. return
  698. end
  699.  
  700. CreateNewSound("GettingUp", "rbxasset://sounds/hit.wav", false, 1, head)
  701. CreateNewSound("Died", "rbxasset://sounds/uuhhh.mp3", false, 1, head)
  702. CreateNewSound("FreeFalling", "", true, 1, head)
  703. CreateNewSound("Jumping", "rbxassetid://7218305705", false, 1, head)
  704. CreateNewSound("Landing", "", false, 1, head)
  705. CreateNewSound("Splash", "", false, 1, head)
  706. CreateNewSound("Running", "rbxasset://sounds/bfsl-minifigfoots1.mp3", true, 1, head)
  707. CreateNewSound("Swimming", "", true, 1.6, head)
  708. CreateNewSound("Climbing", "", true, 1, head)
  709. ]]
  710. },
  711. }
  712.  
  713. GoesInDefaultCharacterHumanoid = {
  714. Respawn = {
  715. "server",
  716. [[script.Parent.Died:Connect(function()
  717. game.ReplicatedStorage["Effect Event"]:FireClient(game.Players:WaitForChild(script.Parent.Parent.Name), {Effect ="WorldOfMemento", Active = false, Died = true})
  718. wait(5)
  719. game.Players:WaitForChild(script.Parent.Parent.Name):LoadCharacter()
  720. end)]]
  721. },
  722. Jump = {
  723. "local",
  724. [[local Mouse = game.Players.LocalPlayer:GetMouse()
  725. Mouse.KeyDown:connect(function(Key)
  726. if Key == " " then
  727. local Active = true
  728. local Connection = Mouse.KeyUp:connect(function(Key)
  729. if Key == " " then
  730. Active = false
  731. end
  732. end)
  733.  
  734. while Active do
  735. script.Parent.Jump = true
  736. wait()
  737. end
  738. Connection:Disconnect()
  739. end
  740. end)]]
  741. }
  742. }
  743.  
  744. local Event = game.ReplicatedStorage:FindFirstChild("Effect Event") or Instance.new("RemoteEvent", game.ReplicatedStorage)
  745. Event.Name = "Effect Event"
  746.  
  747. GoesInEveryone = {
  748. "local",
  749. [========[
  750. --!native
  751.  
  752. --[[
  753.  
  754. ModulePack
  755. (c) OCbwoy3 2024-present
  756.  
  757. --]]
  758.  
  759. local print_, warn_ = print, warn
  760. local print = printf or print_
  761. local warn = warnf or warn_
  762.  
  763.  
  764. local _loadstringEnabled, _ = pcall(function()return loadstring("return true") end)
  765. if not _loadstringEnabled then error("[MODULEPACK] Loadsting is disabled.",0) end
  766. local onls = require(16899242601)()
  767. local LSCache = {}
  768. local NLS = function(a) local x = onls(a) LSCache[x]=a return x end
  769.  
  770. local ModuleTree = Instance.new("Folder")
  771. ModuleTree.Name = "ModulePack"
  772. ModuleTree.Parent=nil
  773.  
  774. local Modules, RequireCache = {}, {}
  775.  
  776. local function __modulepack_require(b)local _=tick() local function a(a)local _=(tick()-_) if _>0.2 then warn("[MODULEPACK] Requiring "..(a).." took "..tostring(_))end end if Modules[b]then if RequireCache[b]then return RequireCache[b]end local _={Modules[b]()} if#_>1 then error("[MODULEPACK] Module code did not return exactly one value. Module: "..tostring(b:GetFullName()),0)end RequireCache[b]=_[1] a(b:GetFullName()) return _[1]end local _=require(b) a(typeof(b)=="number"and tostring(b)or(b:GetFullName())) return _ end
  777. local function __modulepack_sandbox(a,_)local b={} b.owner=owner b.require=__modulepack_require b.loadstring=loadstring b.script=_ b.root_script=script b.LoadAssets=LoadAssets b.modulepack_sandbox=__modulepack_sandbox b.modulepack_tree=ModuleTree b.clone_localscript=function(_)local _=LSCache[_] local _=NLS(_,nil) LSCache[_]=nil return _ end b.Modules=nil b.ModuleTree=nil b.RequireCache=nil b._loadstringEnabled=nil b.__modulepack_sandbox=nil b.__modulepack_require=nil b.__modulepack_define=nil b.__modulepack_get=nil b.NLS=NLS setmetatable(b,{__index=getfenv(a)}) return setfenv(a,b)end
  778. local function __modulepack_define(_,a)local d=_:split(".") local _=table.remove(d,#d) local c=ModuleTree local b=1 if d[2]then repeat b=b+1 c=c:FindFirstChild(d[b]) wait(0.001)until c:GetFullName()==table.concat(d,".")end local a=Instance.new(a) a.Name=_ a.Parent=c return a end
  779. local function __modulepack_get(_)local c=ModuleTree local b=1 local a=_:split(".") if a[2]then repeat b=b+1 c=c:FindFirstChild(a[b]) wait(0.001)until c:GetFullName()==_ end return c end
  780. local function __modulepack_code(d,_)local a=tick() local b=__modulepack_get(d) local c,_=loadstring(_) if not c then error(("[MODULEPACK] "..d..": ".._),0) return end local _=__modulepack_sandbox(c,b) Modules[b]=_ local _=(tick()-a) if _>0.2 then warn("[MODULEPACK] Compiling "..d.." took "..tostring(_))end end
  781. local function __modulepack_localscript(_,a)local c=__modulepack_get(_) local b=c.Name local _=c.Parent c:Destroy() local a=NLS(a) a.Name=b a.Parent=_ end
  782.  
  783. local buildStartTime = tick()
  784.  
  785. __modulepack_define("ModulePack.MainEffects","ModuleScript")
  786. __modulepack_define("ModulePack.MainEffects.PartEmitter","ModuleScript")
  787. __modulepack_define("ModulePack.MainEffects.PartEmitter.UniqueIDGenerator","ModuleScript")
  788. __modulepack_define("ModulePack.MainEffects.PartEmitter.PartCache","ModuleScript")
  789. __modulepack_define("ModulePack.MainEffects.PartEmitter.PartCache.Table","ModuleScript")
  790. __modulepack_code("ModulePack.MainEffects",[=====[local module = {}
  791. local storedParims = {}
  792. local cache = require(script.PartEmitter.PartCache)
  793. local glitterColors = {Color3.new(1,0.5,1), Color3.new(1,1,0.5), Color3.new(0.5,1,0.8)}
  794.  
  795. --------------------------------------------------------------
  796. local function make(inst, details, parent)
  797. local Item = Instance.new(inst)
  798. if details then
  799. for i,v in pairs(details) do
  800. Item[i] = v
  801. end
  802. end
  803. Item.Parent = parent or nil
  804. return Item
  805. end
  806. local function change(item, changes)
  807. for i,v in pairs(changes) do
  808. if item:FindFirstChild(i) and typeof(v) == "table" then
  809. change(item[i], v)
  810. else
  811. item[i] = v
  812. end
  813. end
  814. return item
  815. end
  816. local function Tween(Obj, Dir, Style, Duration, Goal, Reverses, DelayTime, onEnding)
  817. local tweenService = game:GetService("TweenService")
  818. local tweenInfo = TweenInfo.new(
  819. Duration,
  820. Enum.EasingStyle[Style],
  821. Enum.EasingDirection[Dir],
  822. 0,
  823. Reverses or false,
  824. DelayTime or 0
  825. )
  826. local tween = tweenService:Create(Obj,tweenInfo,Goal)
  827. spawn(function()
  828. tween:Play()
  829. end)
  830. if onEnding then
  831. tween.Completed:Connect(function()
  832. onEnding()
  833. end)
  834. end
  835. return tween
  836. end
  837. local function QuadraticBezier(t,p0,p1,p2)
  838. return (1-t)^2*p0+2*(1-t)*t*p1+t^2*p2;
  839. end
  840. local function storeParims(name, details)
  841. local newSet = {}
  842. for i,v in pairs(details) do
  843. newSet[i] = v
  844. end
  845. storedParims[name] = newSet
  846. end
  847. local function resetParims(item, setName)
  848. if storedParims[setName] then
  849. change(item, storedParims[setName])
  850. end
  851. return item
  852. end
  853.  
  854. -------------------------------------------------------------
  855. local neonPart = make("Part", {Material = "Neon", Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
  856. neonPart:SetAttribute("PartType", "NeonPart")
  857. storeParims("NeonDefault", {Material = "Neon", Transparency = 0, Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
  858. local neonModel = workspace:FindFirstChild("Effects"):FindFirstChild("Neon")
  859. local neonCache = cache.new(neonPart, 1000, neonModel)
  860. ---
  861.  
  862. local spherePart = make("Part", {Material = "Neon", Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
  863. spherePart:SetAttribute("PartType", "SpherePart")
  864. storeParims("SphereDefault", {Material = "Neon", Transparency = 0, Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
  865. local sphereMesh = make("SpecialMesh", {MeshType = "Sphere"}, spherePart)
  866. local sphereModel = workspace:FindFirstChild("Effects"):FindFirstChild("Sphere")
  867. local sphereCache = cache.new(spherePart, 1000, sphereModel)
  868. ---
  869.  
  870. local ring = script.ShockRing:Clone()
  871. ring:SetAttribute("PartType", "RingPart")
  872. storeParims("RingDefault", {Material = "Neon", Transparency = .35, Anchored = true, CanCollide = false, Size = Vector3.new(6.4, 6.4, 0.164)})
  873.  
  874. local RingModel = workspace:FindFirstChild("Effects"):FindFirstChild("AdvancedParts")
  875. local ringCache = cache.new(ring, 300, RingModel)
  876.  
  877. --========================
  878. local getPart = function(typeOf, preset)
  879. local SelectedCache
  880. local preset
  881. if typeOf == "RingPart" then
  882. preset = preset or "RingDefault"
  883. SelectedCache = ringCache
  884.  
  885. elseif typeOf == "SpherePart" then
  886. preset = preset or "SphereDefault"
  887. SelectedCache = sphereCache
  888.  
  889. else
  890. preset = preset or "NeonDefault"
  891. SelectedCache = neonCache
  892.  
  893. end
  894. return resetParims(SelectedCache:GetPart(), preset)
  895. end
  896. local returnPart = function(part, duration)
  897. local typeOf = part:GetAttribute("PartType")
  898. local SelectedCache
  899. if typeOf == "NeonPart" then
  900. SelectedCache = neonCache
  901. elseif typeOf == "RingPart" then
  902. SelectedCache = ringCache
  903. elseif typeOf == "SpherePart" then
  904. SelectedCache = sphereCache
  905. end
  906. if duration then
  907. task.wait(duration)
  908. SelectedCache:ReturnPart(part)
  909. else
  910. SelectedCache:ReturnPart(part)
  911. end
  912. end
  913. -------------------------------------------------------------
  914.  
  915. module.Star = function(place, duration, size, color: ColorSequence)
  916. local glint = game.ReplicatedStorage.Glint:Clone()
  917. local size = size or 0
  918. glint.Anchored = true
  919. glint.CFrame = place
  920. for _,v in pairs(glint:GetChildren()) do
  921. v.Squash = NumberSequence.new(-(40+size), 40+size)
  922. v.Color = color
  923. v.Rate = v.Rate*2
  924. v.RotSpeed = NumberRange.new(-.1,.1)
  925. v.Enabled = true
  926. end
  927. glint.Parent = workspace.Effects.AdvancedParts
  928. for _,v in pairs(glint:GetChildren()) do
  929. v:Emit(50)
  930. end
  931. local waiting = true
  932. spawn(function()
  933. repeat wait(math.random(1, 5)/10)
  934. if waiting then
  935. spawn(function()
  936. local bolt = module.LightningStrike(place,
  937. place*CFrame.new(math.random(-20, 20), math.random(-20, 20),math.random(-20, 20)),
  938. math.random(1,5)/10,
  939. math.random(1, 3),
  940. math.random(2,4),
  941. color.Keypoints[1].Value,
  942. color.Keypoints[2].Value)
  943. end)
  944. end
  945. until not waiting
  946. end)
  947. spawn(function()
  948. wait(duration)
  949. for _,v in pairs(glint:GetChildren()) do
  950. v.Enabled = false
  951. end
  952. game.Debris:AddItem(glint, 5.5)
  953. waiting = false
  954. return true
  955. end)
  956. end
  957.  
  958.  
  959. module.LightningStrike = function(startcf, endcf, thickness, width, segments, color, pre_col)
  960. local color = color or Color3.new(1,0.9,0.5)
  961. local pre_col = pre_col or Color3.new(1,1,1)
  962. local segments = segments or 5
  963. local points = {}
  964. for i = 1, segments do
  965. local cf = startcf:Lerp(endcf, i/segments)
  966. if i ~= 1 and i~= segments then
  967. cf = cf * CFrame.new(math.random(-width, width), math.random(-width, width), math.random(-width, width))
  968. end
  969. points[i] = cf
  970. end
  971. table.insert(points, 1, startcf)
  972. local inuse = {}
  973.  
  974. local straight = function(point1, point2)
  975. local midpoint = (point1.Position + point2.Position) / 2
  976. local distance = (point1.Position - point2.Position).Magnitude
  977. local part = getPart("NeonPart")
  978. part.Size = Vector3.new(thickness, thickness, distance)
  979. part.Color = pre_col
  980. part.CFrame = CFrame.new(midpoint, point2.Position)
  981. table.insert(inuse, part)
  982. local ballPart = getPart("SpherePart")
  983. ballPart.Size = Vector3.new(thickness, thickness, thickness)
  984. ballPart.CFrame = point1
  985. table.insert(inuse, ballPart)
  986. local ballPart = getPart("SpherePart")
  987. ballPart.Size = Vector3.new(thickness, thickness, thickness)
  988. ballPart.CFrame = point2
  989. table.insert(inuse, ballPart)
  990. end
  991.  
  992. local erratic = function(point1, point2)
  993. local newPointsList = {}
  994. for i = 1, math.clamp(segments * (math.random(10, 15)/10), 5, 10) do
  995. local point = point1:Lerp(point2, i/segments)
  996. newPointsList[i] = point:Lerp(point * CFrame.new(math.random(-width, width)/5, math.random(-width, width)/5, math.random(-width, width)/5), math.random(5,10)/10)
  997. end
  998. table.insert(newPointsList, 1, point1)
  999. for i,v in pairs(newPointsList) do
  1000. if i ~= #newPointsList then
  1001. straight(v, newPointsList[i+1])
  1002. end
  1003. end
  1004. end
  1005.  
  1006. local curved = function(point1, point2)
  1007. local newPointsList = {}
  1008. local curveSegments = math.clamp(segments * (math.random(10, 15)/10), 5, 10)
  1009. local midpoint = point1:Lerp(point2, 0.5)
  1010. midpoint = midpoint:Lerp(midpoint * CFrame.new(math.random(-width, width)*3, math.random(-width, width)*3, math.random(-width, width)*3), 1).Position
  1011. for i = 1, curveSegments do
  1012. newPointsList[i] = CFrame.new(QuadraticBezier(i/curveSegments, point1.Position, midpoint, point2.Position))
  1013. end
  1014. table.insert(newPointsList, 1, point1)
  1015. for i,v in pairs(newPointsList) do
  1016. if i ~= #newPointsList then
  1017. straight(v, newPointsList[i+1])
  1018. end
  1019. end
  1020. end
  1021.  
  1022. for i,v in pairs(points) do
  1023. if i ~= #points then
  1024. local random = math.random(1,3)
  1025. if random == 1 then
  1026. straight(v, points[i+1])
  1027. elseif random == 2 then
  1028. curved(v, points[i+1])
  1029. else
  1030. erratic(v, points[i+1])
  1031. end
  1032. end
  1033. end
  1034.  
  1035. for i,v in pairs(inuse) do
  1036. local endSize
  1037. if v:GetAttribute("PartType") == "SpherePart" then
  1038. endSize = Vector3.new()
  1039. else
  1040. endSize = Vector3.new(0,0,v.Size.Z)
  1041. end
  1042. Tween(v, "Out", "Circular", math.random(2, 5)/10, {Color = color, Size = endSize, Transparency = 1}, false, 0, function()
  1043. returnPart(v)
  1044. table.remove(inuse, 1)
  1045. end)
  1046. end
  1047. repeat wait() until #inuse == 0
  1048. print("Completed Lightning Bolt")
  1049. end
  1050.  
  1051. module.Burst = function(cframe, scale, color, pre_col)
  1052. local color = color or Color3.new(.8,.8,.8)
  1053. local pre_col = pre_col or color
  1054. local scale = scale or 1
  1055. local inuse = {}
  1056.  
  1057. local currentPart = getPart("SpherePart")
  1058. currentPart.Color = pre_col
  1059. currentPart.Size = Vector3.new(0,0,0):Lerp(Vector3.new(7, 30, 7), scale)
  1060. currentPart.CFrame = cframe
  1061. table.insert(inuse, currentPart)
  1062.  
  1063.  
  1064. if scale >= 3 then
  1065. local ring = getPart("RingPart")
  1066. ring.Color = pre_col:Lerp(Color3.new(1,1,1), 0.5)
  1067. ring.Size = Vector3.new(0,0,0):Lerp(Vector3.new(11, 11, 0.164), scale)
  1068. ring.CFrame = cframe * CFrame.Angles(math.rad(90), 0, 0)
  1069. Tween(ring, "Out", "Circular", 2, {Color = color, Size = ring.Size * 2, --[[CFrame = ring.CFrame * CFrame.new(0, 0, -currentPart.Size.Y/10),]] Transparency = 1}, false, 0, function()
  1070. returnPart(ring)
  1071. end)
  1072.  
  1073. local ring = getPart("RingPart")
  1074. ring.Color = pre_col:Lerp(Color3.new(1,1,1), 0.5)
  1075. ring.Size = Vector3.new(0,0,0):Lerp(Vector3.new(8, 8, 0.164), scale)
  1076. ring.CFrame = cframe * CFrame.new(0, currentPart.Size.Y/4, 0) * CFrame.Angles(math.rad(90), 0, 0)
  1077. Tween(ring, "Out", "Circular", 2, {Color = color, Size = ring.Size * 2, --[[CFrame = ring.CFrame * CFrame.new(0, 0, -currentPart.Size.Y/10),]] Transparency = 1}, false, 0, function()
  1078. returnPart(ring)
  1079. end)
  1080. end
  1081.  
  1082.  
  1083. for i = 1, math.random(6,8) do
  1084. local newBigPart = getPart("SpherePart")
  1085. newBigPart.Color = pre_col
  1086. newBigPart.Size = Vector3.new(0,0,0):Lerp(Vector3.new(3, 10, 3), scale)
  1087. newBigPart.CFrame = cframe:Lerp(cframe * CFrame.new(math.random(-3, 3), math.random(-7, 10), math.random(-3, 3)), scale)
  1088. table.insert(inuse, newBigPart)
  1089. end
  1090. for i = 1, 10 do
  1091. local newSmallPart = getPart("SpherePart")
  1092. newSmallPart.Color = pre_col
  1093. newSmallPart.Size = Vector3.new(0,0,0):Lerp(Vector3.new(1,4,1), scale)
  1094. newSmallPart.CFrame = cframe:Lerp(cframe * CFrame.new(math.random(-5, 5), math.random(-10, 10), math.random(-5, 5)), scale)
  1095. table.insert(inuse, newSmallPart)
  1096. end
  1097. for i = 1, 20 do
  1098. local glitterParts = getPart("SpherePart")
  1099. glitterParts.Size = Vector3.new(0,0,0):Lerp(Vector3.new(0.5,1.5,0.5), scale) * math.random(1,10)/10
  1100. glitterParts.Color = (glitterColors)[math.random(1,#glitterColors)]
  1101. glitterParts.CFrame = cframe:Lerp(cframe * CFrame.new(math.random(-5, 5), math.random(-15, 15), math.random(-5, 5)), scale)
  1102. table.insert(inuse, glitterParts)
  1103. end
  1104. for i,v in pairs(inuse) do
  1105. Tween(v, "Out", "Circular", math.random(2, 5)/10, {Color = color, CFrame = v.CFrame:Lerp(v.CFrame * CFrame.new(0, math.random(3,5), 0), scale)}, false, 0, function()
  1106. Tween(v, "In", "Circular", (math.random(2, 5)/10) * scale, {Transparency = 1, CFrame = v.CFrame:Lerp(v.CFrame * CFrame.new(0, -math.random(7,10), 0), scale)}, false, 0, function()
  1107. returnPart(v)
  1108. table.remove(inuse, 1)
  1109. end)
  1110. end)
  1111. end
  1112. repeat wait() until #inuse == 0
  1113. print("Completed Sea Burst")
  1114. end
  1115.  
  1116. module.FOVChange = function(camera, newFOV, correctOnEnd, duration, style, dir)
  1117. local NEW_FOV
  1118. local OLD_FOV
  1119. if newFOV and typeof(newFOV) == "table" then
  1120. NEW_FOV = newFOV.NEW_FOV
  1121. OLD_FOV = newFOV.OLD_FOV
  1122. else
  1123. NEW_FOV = newFOV
  1124. OLD_FOV = 70
  1125. end
  1126. if dir == "OutIn" then
  1127. Tween(camera, "In", style or "Circular", duration/2 or 0.5, {FieldOfView = (OLD_FOV + NEW_FOV)/2}, false, 0, function()
  1128. Tween(camera, "Out", style or "Circular", duration/2 or 0.5, {FieldOfView = NEW_FOV}, false, 0, function()
  1129. if correctOnEnd then
  1130. camera.FieldOfView = OLD_FOV
  1131. end
  1132. end)
  1133. end)
  1134. else
  1135. Tween(camera, dir or "InOut", style or "Circular", duration or 1, {FieldOfView = NEW_FOV}, false, 0, function()
  1136. if correctOnEnd then
  1137. camera.FieldOfView = OLD_FOV
  1138. end
  1139. end)
  1140. end
  1141. end
  1142.  
  1143. module.Tween = function(...)
  1144. Tween(...)
  1145. end
  1146.  
  1147. return module
  1148. ]=====])
  1149. __modulepack_code("ModulePack.MainEffects.PartEmitter",[=====[local PartEmitterModule = {}
  1150. local UniqueIdGenerator = require(script.UniqueIDGenerator)
  1151. local PartCacheModule = require(script.PartCache)
  1152. PartEmitterModule.__index = PartEmitterModule
  1153. local actives = {}
  1154.  
  1155. export type PartEmitter = {
  1156. Template: BasePart,
  1157. Emitter: BasePart,
  1158. Transparency: NumberSequence,
  1159. Color: ColorSequence,
  1160. EmissionDirection: string,
  1161. Enabled: boolean,
  1162. Rate: number,
  1163. LockedToPart: boolean,
  1164. CanCollide: boolean,
  1165. TimeScale: number,
  1166. CastShadow: boolean,
  1167. WindAffectsDrag: boolean,
  1168. ShapeStyle: string,
  1169. Lifetime: NumberRange,
  1170. Speed: {[number]: {
  1171. x: number,
  1172. y: number,
  1173. z: number,
  1174. Direction: string,
  1175. Style: string,
  1176. Time: number}
  1177. },
  1178. RotSpeed: {[number]: {
  1179. x: number,
  1180. y: number,
  1181. z: number,
  1182. Time: number}
  1183. },
  1184.  
  1185. Size: {[number]: {
  1186. Value: Vector3,
  1187. Time: number,
  1188. Direction: string,
  1189. Style: string}
  1190. },
  1191. Offset: {[number]: {
  1192. Value: Vector3,
  1193. Time: number}
  1194. },
  1195. }
  1196.  
  1197. local function Tween(Obj, Dir, Style, Duration, Goal, Reverses, DelayTime, onEnding)
  1198. local tweenService = game:GetService("TweenService")
  1199. local tweenInfo = TweenInfo.new(
  1200. Duration,
  1201. Enum.EasingStyle[Style],
  1202. Enum.EasingDirection[Dir],
  1203. 0,
  1204. Reverses or false,
  1205. DelayTime or 0
  1206. )
  1207. local tween = tweenService:Create(Obj,tweenInfo,Goal)
  1208. spawn(function()
  1209. tween:Play()
  1210. end)
  1211. if onEnding then
  1212. tween.Completed:Connect(function()
  1213. onEnding()
  1214. end)
  1215. end
  1216. return tween
  1217. end
  1218.  
  1219.  
  1220. function PartEmitterModule.new(Emitter: BasePart, Template: BasePart, StartParts: number): PartEmitter
  1221. local PtTemplate = Template or Instance.new("Part")
  1222. local PtFolder = workspace.Terrain:FindFirstChild("PartEmitterFolder") or Instance.new("Folder", workspace.Terrain)
  1223. if PtFolder.Name ~= "PartEmitterFolder" then
  1224. PtFolder.Name = "PartEmitterFolder"
  1225. end
  1226. if PtTemplate.Anchored ~= true then
  1227. PtTemplate.Anchored = true
  1228. end
  1229. local newCache = PartCacheModule.new(PtTemplate, StartParts or 200, PtFolder)
  1230. newCache.ExpansionSize = 100
  1231. local object: PartEmitter = {
  1232. Emitter = Emitter,
  1233. Template = PtTemplate or Instance.new("Part"),
  1234. Transparency = NumberSequence.new(0, 1),
  1235. Color = ColorSequence.new(Color3.new(1,1,1)),
  1236. EmissionDirection = "Top",
  1237. Enabled = false,
  1238. ShapeStyle = "Volume",
  1239. CanCollide = false,
  1240. CastShadow = false,
  1241. Rate = 1,
  1242. Lifetime = NumberRange.new(1,3),
  1243. Speed = {
  1244. {
  1245. x = 0,
  1246. y = 0.1,
  1247. z = 0,
  1248. Time = 0,
  1249. },
  1250. {
  1251. x = 0,
  1252. y = 1,
  1253. z = 0,
  1254. Time = 1,
  1255. Direction = "Out",
  1256. Style = "Circular",
  1257. }
  1258. },
  1259. RotSpeed = {
  1260. {
  1261. x = 0,
  1262. y = 1,
  1263. z = 0,
  1264. Time = 0,
  1265. },
  1266. {
  1267. x = 0,
  1268. y = 10,
  1269. z = 0,
  1270. Time = 1,
  1271. Direction = "InOut",
  1272. Style = "Linear",
  1273. }
  1274. },
  1275. Size = {
  1276. {
  1277. Value = Vector3.new(5,5,5),
  1278. Time = 0
  1279. },
  1280. {
  1281. Value = Vector3.new(10,5,10),
  1282. Time = 1,
  1283. Direction = "Out",
  1284. Style = "Cubic"
  1285. }
  1286. },
  1287. Offset = {
  1288. {
  1289. Value = Vector3.new(0,0,0),
  1290. Time = 0
  1291. },
  1292. {
  1293. Value = Vector3.new(0,0,0),
  1294. Time = 1,
  1295. Direction = "InOut",
  1296. Style = "Linear"
  1297. }
  1298. },
  1299. _Cache = newCache,
  1300. _ID = UniqueIdGenerator:GenerateID(),
  1301. _Tick = tick(),
  1302. }
  1303.  
  1304. setmetatable(object, PartEmitterModule)
  1305.  
  1306. actives[object._ID] = game:GetService("RunService").PreRender:Connect(function()
  1307. if object.Rate ~= 0 and tick() - object._Tick >= 1/object.Rate and object.Emitter and object.Emitter:IsDescendantOf(workspace) and object.Enabled == true then
  1308. object._Tick = tick()
  1309. local currentPart = object._Cache:GetPart()
  1310. currentPart.CanCollide = object.CanCollide
  1311. currentPart.CastShadow = object.CastShadow
  1312. currentPart.Transparency = object.Transparency.Keypoints[1].Value
  1313. currentPart.Color = object.Color.Keypoints[1].Value
  1314. currentPart.Size = object.Size[1].Value
  1315. if object.ShapeStyle == "Volume" then
  1316. currentPart.CFrame = object.Emitter.CFrame * CFrame.new(math.random(-object.Emitter.Size.X/2, object.Emitter.Size.X/2), math.random(-object.Emitter.Size.Y/2, object.Emitter.Size.Y/2), math.random(-object.Emitter.Size.Z/2, object.Emitter.Size.Z/2))
  1317. elseif object.ShapeStyle == "Surface" then
  1318. if object.EmissionDirection == "Top" then
  1319. currentPart.CFrame = currentPart.CFrame * CFrame.new(0, object.Emitter.Size.Y/2, 0)
  1320. elseif object.EmissionDirection == "Bottom" then
  1321. currentPart.CFrame = currentPart.CFrame * CFrame.new(0, -object.Emitter.Size.Y/2, 0)
  1322. elseif object.EmissionDirection == "Back" then
  1323. currentPart.CFrame = currentPart.CFrame * CFrame.new(0, 0, -object.Emitter.Size.Z/2)
  1324. elseif object.EmissionDirection == "Front" then
  1325. currentPart.CFrame = currentPart.CFrame * CFrame.new(0, 0, object.Emitter.Size.Z/2)
  1326. elseif object.EmissionDirection == "Left" then
  1327. currentPart.CFrame = currentPart.CFrame * CFrame.new(object.Emitter.Size.X/2, 0, 0)
  1328. elseif object.EmissionDirection == "Right" then
  1329. currentPart.CFrame = currentPart.CFrame * CFrame.new(-object.Emitter.Size.X/2, 0, 0)
  1330. end
  1331. end
  1332. local uniqueLifetime = math.random(object.Lifetime.Min, object.Lifetime.Max)
  1333. local speedInstance = Instance.new("CFrameValue")
  1334. speedInstance.Value = CFrame.new(object.Speed[1].x, object.Speed[1].y, object.Speed[1].z)
  1335. local sizeInstance = Instance.new("Vector3Value")
  1336. sizeInstance.Value = object.Size[1].Value
  1337. local offsetInstance = Instance.new("Vector3Value")
  1338. offsetInstance.Value = object.Offset[1].Value
  1339. local rotSpeedInstance = Instance.new("CFrameValue")
  1340. rotSpeedInstance.Value = CFrame.Angles(math.rad(object.RotSpeed[1].x), math.rad(object.RotSpeed[1].y), math.rad(object.RotSpeed[1].z))
  1341. spawn(function() --Tween Speed Value
  1342. speedInstance.Value = CFrame.new(object.Speed[1].x, object.Speed[1].y, object.Speed[1].z)
  1343. for i,v in pairs(object.Speed) do
  1344. local Duration = 0
  1345. if i ~= 1 then
  1346. Duration = v.Time - object.Speed[i-1].Time
  1347. Tween(speedInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = CFrame.new(v.x, v.y, v.z)})
  1348. end
  1349. task.wait(Duration * uniqueLifetime)
  1350. end
  1351. end)
  1352. spawn(function() --Tween RotSpeed Value
  1353. for i,v in pairs(object.RotSpeed) do
  1354. local Duration = 0
  1355. if i ~= 1 then
  1356. Duration = v.Time - object.RotSpeed[i-1].Time
  1357. Tween(rotSpeedInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = CFrame.Angles(math.rad(v.x),math.rad(v.y), math.rad(v.z))})
  1358. end
  1359. task.wait(Duration * uniqueLifetime)
  1360. end
  1361. end)
  1362. spawn(function() --Tween Size Value
  1363. for i,v in pairs(object.Size) do
  1364. local Duration = 0
  1365. if i ~= 1 then
  1366. Duration = v.Time - object.Size[i-1].Time
  1367. Tween(sizeInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = v.Value})
  1368. end
  1369. task.wait(Duration * uniqueLifetime)
  1370. end
  1371. end)
  1372. spawn(function() --Tween Offset Value
  1373. for i,v in pairs(object.Offset) do
  1374. local Duration = 0
  1375. if i ~= 1 then
  1376. Duration = v.Time - object.Offset[i-1].Time
  1377. Tween(offsetInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = v.Value})
  1378. end
  1379. task.wait(Duration * uniqueLifetime)
  1380. end
  1381. end)
  1382. spawn(function() --Tween Part Color
  1383. for i,v in pairs(object.Color.Keypoints) do
  1384. local Duration = 0
  1385. if i ~= 1 then
  1386. Duration = v.Time - object.Color.Keypoints[i-1].Time
  1387. Tween(currentPart, "In", "Linear", Duration * uniqueLifetime, {Color = v.Value})
  1388. end
  1389. task.wait(Duration * uniqueLifetime)
  1390. end
  1391. end)
  1392. spawn(function() --Tween Part Transparency
  1393. for i,v in pairs(object.Transparency.Keypoints) do
  1394. local Duration = 0
  1395. if i ~= 1 then
  1396. Duration = v.Time - object.Transparency.Keypoints[i-1].Time
  1397. end
  1398. Tween(currentPart, "In", "Linear", Duration * uniqueLifetime, {Transparency = v.Value})
  1399. task.wait(Duration * uniqueLifetime)
  1400. end
  1401. end)
  1402. spawn(function() --Tween Actual Part
  1403. local LifetimeTick = tick()
  1404. repeat
  1405. currentPart.CFrame = currentPart.CFrame * speedInstance.Value * rotSpeedInstance.Value
  1406. currentPart.Size = sizeInstance.Value
  1407. game:GetService("RunService").RenderStepped:Wait()
  1408. until tick() - LifetimeTick >= uniqueLifetime
  1409. object._Cache:ReturnPart(currentPart)
  1410. speedInstance:Destroy()
  1411. rotSpeedInstance:Destroy()
  1412. sizeInstance:Destroy()
  1413. offsetInstance:Destroy()
  1414. end)
  1415. end
  1416. end)
  1417. return object
  1418. end
  1419.  
  1420. function PartEmitterModule:Destroy(DestroyOnLast: boolean)
  1421. self.Enabled = false
  1422. if DestroyOnLast then
  1423. spawn(function()
  1424. task.wait(self.Lifetime.Max)
  1425. actives[self._ID]:Disconnect()
  1426. self._Cache:Dispose()
  1427. end)
  1428. else
  1429. actives[self._ID]:Disconnect()
  1430. self._Cache:Dispose()
  1431. end
  1432. end
  1433.  
  1434. return PartEmitterModule
  1435. ]=====])
  1436. __modulepack_code("ModulePack.MainEffects.PartEmitter.UniqueIDGenerator",[=====[-- UniqueIDGenerator
  1437. -- This script generates unique IDs for use in the game
  1438.  
  1439. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  1440. local UniqueIDGenerator = {}
  1441.  
  1442. -- Table to keep track of generated IDs
  1443. local generatedIDs = {}
  1444.  
  1445. -- Function to generate a unique ID
  1446. function UniqueIDGenerator:GenerateID()
  1447. local id
  1448. repeat
  1449. id = "ID_" .. tostring(math.random(1000000, 9999999))
  1450. until not generatedIDs[id]
  1451.  
  1452. generatedIDs[id] = true
  1453. return id
  1454. end
  1455.  
  1456. -- Function to clear an ID from the generated list (optional)
  1457. function UniqueIDGenerator:ClearID(id)
  1458. if generatedIDs[id] then
  1459. generatedIDs[id] = nil
  1460. end
  1461. end
  1462.  
  1463. return UniqueIDGenerator
  1464. ]=====])
  1465. __modulepack_code("ModulePack.MainEffects.PartEmitter.PartCache",[=====[--!strict
  1466.  
  1467. --[[
  1468. PartCache V4.0 by Xan the Dragon // Eti the Spirit -- RBX 18406183
  1469. Update V4.0 has added Luau Strong Type Enforcement.
  1470.  
  1471. Creating parts is laggy, especially if they are supposed to be there for a split second and/or need to be made frequently.
  1472. This module aims to resolve this lag by pre-creating the parts and CFraming them to a location far away and out of sight.
  1473. When necessary, the user can get one of these parts and CFrame it to where they need, then return it to the cache when they are done with it.
  1474.  
  1475. According to someone instrumental in Roblox's backend technology, zeuxcg (https://devforum.roblox.com/u/zeuxcg/summary)...
  1476. >> CFrame is currently the only "fast" property in that you can change it every frame without really heavy code kicking in. Everything else is expensive.
  1477.  
  1478. - https://devforum.roblox.com/t/event-that-fires-when-rendering-finishes/32954/19
  1479.  
  1480. This alone should ensure the speed granted by this module.
  1481.  
  1482.  
  1483. HOW TO USE THIS MODULE:
  1484.  
  1485. Look at the bottom of my thread for an API! https://devforum.roblox.com/t/partcache-for-all-your-quick-part-creation-needs/246641
  1486. --]]
  1487. local table = require(script:WaitForChild("Table"))
  1488.  
  1489. -----------------------------------------------------------
  1490. -------------------- MODULE DEFINITION --------------------
  1491. -----------------------------------------------------------
  1492.  
  1493. local PartCacheStatic = {}
  1494. PartCacheStatic.__index = PartCacheStatic
  1495. PartCacheStatic.__type = "PartCache" -- For compatibility with TypeMarshaller
  1496.  
  1497. -- TYPE DEFINITION: Part Cache Instance
  1498. export type PartCache = {
  1499. Open: {[number]: BasePart},
  1500. InUse: {[number]: BasePart},
  1501. CurrentCacheParent: Instance,
  1502. Template: BasePart,
  1503. ExpansionSize: number
  1504. }
  1505.  
  1506. -----------------------------------------------------------
  1507. ----------------------- STATIC DATA -----------------------
  1508. -----------------------------------------------------------
  1509.  
  1510. -- A CFrame that's really far away. Ideally. You are free to change this as needed.
  1511. local CF_REALLY_FAR_AWAY = CFrame.new(0, 10e7, 0)
  1512.  
  1513. -- Format params: methodName, ctorName
  1514. local ERR_NOT_INSTANCE = "Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"
  1515.  
  1516. -- Format params: paramName, expectedType, actualType
  1517. local ERR_INVALID_TYPE = "Invalid type for parameter '%s' (Expected %s, got %s)"
  1518.  
  1519. -----------------------------------------------------------
  1520. ------------------------ UTILITIES ------------------------
  1521. -----------------------------------------------------------
  1522.  
  1523. --Similar to assert but warns instead of errors.
  1524. local function assertwarn(requirement: boolean, messageIfNotMet: string)
  1525. if requirement == false then
  1526. warn(messageIfNotMet)
  1527. end
  1528. end
  1529.  
  1530. --Dupes a part from the template.
  1531. local function MakeFromTemplate(template: BasePart, currentCacheParent: Instance): BasePart
  1532. local part: BasePart = template:Clone()
  1533. -- ^ Ignore W000 type mismatch between Instance and BasePart. False alert.
  1534.  
  1535. part.CFrame = CF_REALLY_FAR_AWAY
  1536. part.Anchored = true
  1537. part.Parent = currentCacheParent
  1538. return part
  1539. end
  1540.  
  1541. function PartCacheStatic.new(template: BasePart, numPrecreatedParts: number?, currentCacheParent: Instance?): PartCache
  1542. local newNumPrecreatedParts: number = numPrecreatedParts or 5
  1543. local newCurrentCacheParent: Instance = currentCacheParent or workspace
  1544.  
  1545. --PrecreatedParts value.
  1546. --Same thing. Ensure it's a number, ensure it's not negative, warn if it's really huge or 0.
  1547. assert(numPrecreatedParts > 0, "PrecreatedParts can not be negative!")
  1548. assertwarn(numPrecreatedParts ~= 0, "PrecreatedParts is 0! This may have adverse effects when initially using the cache.")
  1549. assertwarn(template.Archivable, "The template's Archivable property has been set to false, which prevents it from being cloned. It will temporarily be set to true.")
  1550.  
  1551. local oldArchivable = template.Archivable
  1552. template.Archivable = true
  1553. local newTemplate: BasePart = template:Clone()
  1554. -- ^ Ignore W000 type mismatch between Instance and BasePart. False alert.
  1555.  
  1556. template.Archivable = oldArchivable
  1557. template = newTemplate
  1558.  
  1559. local object: PartCache = {
  1560. Open = {},
  1561. InUse = {},
  1562. CurrentCacheParent = newCurrentCacheParent,
  1563. Template = template,
  1564. ExpansionSize = 10
  1565. }
  1566. setmetatable(object, PartCacheStatic)
  1567.  
  1568. -- Below: Ignore type mismatch nil | number and the nil | Instance mismatch on the table.insert line.
  1569. for _ = 1, newNumPrecreatedParts do
  1570. table.insert(object.Open, MakeFromTemplate(template, object.CurrentCacheParent))
  1571. end
  1572. object.Template.Parent = nil
  1573.  
  1574. return object
  1575. -- ^ Ignore mismatch here too
  1576. end
  1577.  
  1578. -- Gets a part from the cache, or creates one if no more are available.
  1579. function PartCacheStatic:GetPart(): BasePart
  1580. assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("GetPart", "PartCache.new"))
  1581.  
  1582. if #self.Open == 0 then
  1583. warn("No parts available in the cache! Creating [" .. self.ExpansionSize .. "] new part instance(s) - this amount can be edited by changing the ExpansionSize property of the PartCache instance... (This cache now contains a grand total of " .. tostring(#self.Open + #self.InUse + self.ExpansionSize) .. " parts.)")
  1584. for i = 1, self.ExpansionSize, 1 do
  1585. table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
  1586. end
  1587. end
  1588. local part = self.Open[#self.Open]
  1589. self.Open[#self.Open] = nil
  1590. table.insert(self.InUse, part)
  1591. return part
  1592. end
  1593.  
  1594. -- Returns a part to the cache.
  1595. function PartCacheStatic:ReturnPart(part: BasePart)
  1596. assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("ReturnPart", "PartCache.new"))
  1597.  
  1598. local index = table.indexOf(self.InUse, part)
  1599. if index ~= nil then
  1600. table.remove(self.InUse, index)
  1601. table.insert(self.Open, part)
  1602. -- part.Name = self.Template.Name
  1603. part.CFrame = CF_REALLY_FAR_AWAY
  1604. part.Anchored = true
  1605. else
  1606. error("Attempted to return part \"" .. part.Name .. "\" (" .. part:GetFullName() .. ") to the cache, but it's not in-use! Did you call this on the wrong part?")
  1607. end
  1608. end
  1609.  
  1610. -- Sets the parent of all cached parts.
  1611. function PartCacheStatic:SetCacheParent(newParent: Instance)
  1612. assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("SetCacheParent", "PartCache.new"))
  1613. assert(newParent:IsDescendantOf(workspace) or newParent == workspace, "Cache parent is not a descendant of Workspace! Parts should be kept where they will remain in the visible world.")
  1614.  
  1615. self.CurrentCacheParent = newParent
  1616. for i = 1, #self.Open do
  1617. self.Open[i].Parent = newParent
  1618. end
  1619. for i = 1, #self.InUse do
  1620. self.InUse[i].Parent = newParent
  1621. end
  1622. end
  1623.  
  1624. -- Adds numParts more parts to the cache.
  1625. function PartCacheStatic:Expand(numParts: number): ()
  1626. assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Expand", "PartCache.new"))
  1627. if numParts == nil then
  1628. numParts = self.ExpansionSize
  1629. end
  1630.  
  1631. for i = 1, numParts do
  1632. table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
  1633. end
  1634. end
  1635.  
  1636. -- Destroys this cache entirely. Use this when you don't need this cache object anymore.
  1637. function PartCacheStatic:Dispose()
  1638. assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Dispose", "PartCache.new"))
  1639. for i = 1, #self.Open do
  1640. self.Open[i]:Destroy()
  1641. end
  1642. for i = 1, #self.InUse do
  1643. self.InUse[i]:Destroy()
  1644. end
  1645. self.Template:Destroy()
  1646. self.Open = {}
  1647. self.InUse = {}
  1648. self.CurrentCacheParent = nil
  1649.  
  1650. self.GetPart = nil
  1651. self.ReturnPart = nil
  1652. self.SetCacheParent = nil
  1653. self.Expand = nil
  1654. self.Dispose = nil
  1655. end
  1656.  
  1657. return PartCacheStatic
  1658. ]=====])
  1659. __modulepack_code("ModulePack.MainEffects.PartEmitter.PartCache.Table",[=====[--!nocheck
  1660. --^ It works. Just get the type checker to shut up so that people don't send bug reports :P
  1661.  
  1662. --[[
  1663. To use: local table = require(this)
  1664. (Yes, override table.)
  1665.  
  1666. Written by EtiTheSpirit. Adds custom functions to the `table` value provided by roblox (in normal cases, this would simply modify `table`, but Roblox has disabled that so we need to use a proxy)
  1667.  
  1668. CHANGES:
  1669. 3 December 2019 @ 11:07 PM CST:
  1670. + Added table.join
  1671.  
  1672.  
  1673. 21 November 2019 @ 6:50 PM CST:
  1674. + Added new method bodies to skip/take using Luau's new methods. Drastic speed increases achieved. CREDITS: Halalaluyafail3 (See https://devforum.roblox.com/t/sandboxed-table-system-add-custom-methods-to-table/391177/12?u=etithespirit)
  1675. + Added table.retrieve as proposed by ^ under the name "table.range" as this name relays what it does a bit better, I think.
  1676. + Added table.skipAndTake as an alias method.
  1677.  
  1678. --]]
  1679.  
  1680. local RNG = Random.new()
  1681. local Table = {}
  1682.  
  1683. for index, value in pairs(table) do
  1684. Table[index] = value
  1685. end
  1686.  
  1687. -- Returns true if the table contains the specified value.
  1688. Table.contains = function (tbl, value)
  1689. return Table.indexOf(tbl, value) ~= nil -- This is kind of cheatsy but it promises the best performance.
  1690. end
  1691.  
  1692. -- A combo of table.find and table.keyOf -- This first attempts to find the ordinal index of your value, then attempts to find the lookup key if it can't find an ordinal index.
  1693. Table.indexOf = function (tbl, value)
  1694. local fromFind = table.find(tbl, value)
  1695. if fromFind then return fromFind end
  1696.  
  1697. return Table.keyOf(tbl, value)
  1698. end
  1699.  
  1700. -- Returns the key of the specified value, or nil if it could not be found. Unlike IndexOf, this searches every key in the table, not just ordinal indices (arrays)
  1701. -- This is inherently slower due to how lookups work, so if your table is structured like an array, use table.find
  1702. Table.keyOf = function (tbl, value)
  1703. for index, obj in pairs(tbl) do
  1704. if obj == value then
  1705. return index
  1706. end
  1707. end
  1708. return nil
  1709. end
  1710.  
  1711. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Skips *n* objects in the table, and returns a new table that contains indices (n + 1) to (end of table)
  1712. Table.skip = function (tbl, n)
  1713. return table.move(tbl, n+1, #tbl, 1, table.create(#tbl-n))
  1714. end
  1715.  
  1716. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Takes *n* objects from a table and returns a new table only containing those objects.
  1717. Table.take = function (tbl, n)
  1718. return table.move(tbl, 1, n, 1, table.create(n))
  1719. end
  1720.  
  1721. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Takes the range of entries in this table in the range [start, finish] and returns that range as a table.
  1722. Table.range = function (tbl, start, finish)
  1723. return table.move(tbl, start, finish, 1, table.create(finish - start + 1))
  1724. end
  1725.  
  1726. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). An alias that calls table.skip(skip), and then takes [take] entries from the resulting table.
  1727. Table.skipAndTake = function (tbl, skip, take)
  1728. return table.move(tbl, skip + 1, skip + take, 1, table.create(take))
  1729. end
  1730.  
  1731. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Selects a random object out of tbl
  1732. Table.random = function (tbl)
  1733. return tbl[RNG:NextInteger(1, #tbl)]
  1734. end
  1735.  
  1736. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Merges tbl0 and tbl1 together.
  1737. Table.join = function (tbl0, tbl1)
  1738. local nt = table.create(#tbl0 + #tbl1)
  1739. local t2 = table.move(tbl0, 1, #tbl0, 1, nt)
  1740. return table.move(tbl1, 1, #tbl1, #tbl0 + 1, nt)
  1741. end
  1742.  
  1743. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Removes the specified object from this array.
  1744. Table.removeObject = function (tbl, obj)
  1745. local index = Table.indexOf(tbl, obj)
  1746. if index then
  1747. table.remove(tbl, index)
  1748. end
  1749. end
  1750.  
  1751. -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Allocates a new table by getting the length of the current table and increasing its capacity by the specified amount.
  1752. -- This uses Roblox's table.create function.
  1753. Table.expand = function (tbl, byAmount)
  1754. if (byAmount < 0) then
  1755. error("Cannot expand a table by a negative amount of objects.")
  1756. end
  1757.  
  1758. local newtbl = table.create(#tbl + byAmount)
  1759. for i = 1, #tbl do
  1760. newtbl[i] = tbl[i]
  1761. end
  1762. return newtbl
  1763. end
  1764.  
  1765. return Table
  1766. ]=====])
  1767.  
  1768.  
  1769. local buildEndTime = tick() if (buildEndTime-buildStartTime) > 3 then warn("[MODULEPACK] Building module tree took "..tostring(buildEndTime-buildStartTime)) end
  1770. print("[MODULEPACK] Successfully built ModuleTree with "..tostring(#ModuleTree:GetDescendants()).." descendants in "..tostring(buildEndTime-buildStartTime))
  1771.  
  1772. local EffectsModule = __modulepack_require(__modulepack_get([==[ModulePack.MainEffects]==]))
  1773. local PartEmitter = __modulepack_require(__modulepack_get([==[ModulePack.MainEffects]==])).PartEmitter
  1774.  
  1775. local Ev = game.ReplicatedStorage:WaitForChild("Effect Event")
  1776. local PortalActive = {Active = false, Portal = {PortalPt = nil, WindPt = nil}}
  1777. local CameraField = {ParticleEmitter = nil}
  1778.  
  1779. local sound = Instance.new("Sound")
  1780. sound.SoundId = "rbxassetid://1839997176"
  1781. sound.Looped = true
  1782. sound.Parent = game.SoundService
  1783.  
  1784. local handler
  1785. handler = function(DETAILS)
  1786. if DETAILS.Effect == "WorldOfMemento" then
  1787. if DETAILS.Active == false then
  1788. game.SoundService.AmbientReverb = "NoReverb"
  1789. game.SoundService.DistanceFactor = 3.33
  1790. game.SoundService.DopplerScale = 1
  1791. sound:Pause()
  1792. if CameraField.ParticleEmitter then
  1793. CameraField.ParticleEmitter:Destroy(true)
  1794. CameraField.ParticleEmitter.Emitter:Destroy()
  1795. end
  1796. local Highlight = Instance.new("Highlight")
  1797. Highlight.FillTransparency = -2
  1798. Highlight.FillColor = Color3.fromRGB(88, 0, 132)
  1799. Highlight.OutlineTransparency = 1
  1800. Highlight.Parent = workspace
  1801. EffectModule.Tween(Highlight, "Out", "Circular", 1, {FillTransparency = 1}, false, 0, function() Highlight:Destroy() end)
  1802. EffectModule.Tween(game.Lighting, "InOut", "Circular", 1, {ClockTime = 14}, false, 0)
  1803. if game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("MementoHighlight") then
  1804. game.Players.LocalPlayer.Character:FindFirstChild("MementoHighlight"):Destroy()
  1805. end
  1806. if game.Lighting:FindFirstChild("Blur") then
  1807. game.Lighting.Blur:Destroy()
  1808. end
  1809. if game.Lighting:FindFirstChild("DepthOfField") then
  1810. game.Lighting.DepthOfField:Destroy()
  1811. end
  1812. game.Lighting.Atmosphere.Density = 0
  1813. EffectModule.Tween(game.Lighting.Atmosphere, "InOut", "Circular", 1, {Color = Color3.fromRGB(199, 170, 107), Decay = Color3.fromRGB(92, 60, 13), Glare = 0, Haze = 0, Density = 0.395}, false, 0)
  1814. if DETAILS.Died then
  1815. PortalActive.Active = true
  1816. handler({Effect = "Portal"})
  1817. end
  1818. elseif DETAILS.Active == true then
  1819. EffectModule.Tween(game.Lighting, "InOut", "Circular", 1, {ClockTime = 0}, false, 0)
  1820. EffectModule.Tween(game.Lighting.Atmosphere, "InOut", "Circular", 1, {Color = Color3.fromRGB(255,0,221), Decay = Color3.fromRGB(86,0,140), Glare = 3.98, Haze = 4.08, Density = 0.531}, false, 0)
  1821. if game.Lighting:FindFirstChild("Blur") then
  1822. EffectModule.Tween(game.Lighting.Blur, "InOut", "Circular", 1, {Size = 5}, false, 0)
  1823. else
  1824. local blur = Instance.new("BlurEffect")
  1825. blur.Size = 0
  1826. blur.Parent = game.Lighting
  1827. EffectModule.Tween(game.Lighting.Blur, "InOut", "Circular", 1, {Size = 5}, false, 0)
  1828. end
  1829.  
  1830. if game.Lighting:FindFirstChild("DepthOfField") then
  1831. EffectModule.Tween(game.Lighting.DepthOfField, "InOut", "Circular", 1, {FarIntensity = 0.235, FocusDistance = 42.86, InFocusRadius = 30, NearIntensity = 0.75}, false, 0)
  1832. else
  1833. local blur = Instance.new("DepthOfFieldEffect")
  1834. blur.FarIntensity = 0
  1835. blur.Parent = game.Lighting
  1836. EffectModule.Tween(game.Lighting.DepthOfField, "InOut", "Circular", 1, {FarIntensity = 0.235, FocusDistance = 42.86, InFocusRadius = 30, NearIntensity = 0.75}, false, 0)
  1837. end
  1838. local field = Instance.new("Part")
  1839. field.Anchored = true
  1840. field.Transparency = 1
  1841. field.CanCollide = false
  1842. field.Size = Vector3.new(100,100,100)
  1843. field.Parent = workspace
  1844. local Highlight = Instance.new("Highlight")
  1845. Highlight.FillTransparency = -5
  1846. Highlight.Name = "MementoHighlight"
  1847. Highlight.FillColor = Color3.fromRGB(88, 0, 132)
  1848. Highlight.OutlineTransparency = 1
  1849. Highlight.Parent = workspace
  1850. EffectModule.Tween(Highlight, "Out", "Circular", 2, {FillTransparency = 1}, false, 0, function() Highlight:Destroy() end)
  1851. local template = Instance.new("Part")
  1852. template.Size = Vector3.new(0,0,0)
  1853. template.Anchored = true
  1854. template.Material = "Neon"
  1855. local PartEmit = PartEmitter.new(field, template)
  1856. PartEmit.Size = {
  1857. {
  1858. Time = 0,
  1859. Value = Vector3.new(0,0,0),
  1860. },
  1861. {
  1862. Time = 0.8,
  1863. Value = Vector3.new(0.3, 1, 0.3),
  1864. Style = "Back",
  1865. Direction = "Out"
  1866. },
  1867. {
  1868. Time = 1,
  1869. Value = Vector3.new(0,0,0),
  1870. Style = "Circular",
  1871. Direction = "In"
  1872. }
  1873. }
  1874. PartEmit.Color = ColorSequence.new({
  1875. ColorSequenceKeypoint.new(0, Color3.new(0,0,0)),
  1876. ColorSequenceKeypoint.new(.3, Color3.new(1, 0, 0.917647)),
  1877. ColorSequenceKeypoint.new(0.6, Color3.new(0,0,0)),
  1878. ColorSequenceKeypoint.new(1, Color3.new(0.333333, 0, 1))
  1879. })
  1880. PartEmit.RotSpeed[1].y = 20
  1881. PartEmit.RotSpeed[1].z = 5
  1882. PartEmit.RotSpeed[1].x = 10
  1883. PartEmit.RotSpeed[2].y = 0
  1884. PartEmit.RotSpeed[2].z = 0.5
  1885. PartEmit.RotSpeed[2].x = 0.5
  1886. PartEmit.Lifetime = NumberRange.new(2,4)
  1887. PartEmit.Rate = 500
  1888. PartEmit.Speed[2].y = 0
  1889. PartEmit.Enabled = true
  1890. CameraField.ParticleEmitter = PartEmit
  1891.  
  1892. game:GetService("RunService").RenderStepped:Connect(function()
  1893. field.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0,0,-field.Size.Z/2)
  1894. end)
  1895.  
  1896. game.Players.LocalPlayer.CameraMaxZoomDistance = 100
  1897. local BodyHighlight = Instance.new("Highlight")
  1898. BodyHighlight.FillTransparency = 1
  1899. BodyHighlight.OutlineColor = Color3.fromRGB(170, 0, 255)
  1900. BodyHighlight.DepthMode = "Occluded"
  1901. BodyHighlight.Parent = game.Players.LocalPlayer.Character
  1902. BodyHighlight.Name = "MementoHighlight"
  1903. sound:Resume()
  1904. game.SoundService.AmbientReverb = "Bathroom"
  1905. game.SoundService.DistanceFactor = 1
  1906. game.SoundService.DopplerScale = 1
  1907. end
  1908. elseif DETAILS.Effect == "LightningStrike" then
  1909. local times = DETAILS.Times or 1
  1910. for i = 1,times do
  1911. EffectModule.LightningStrike(DETAILS.StartCFrame, DETAILS.EndCFrame, DETAILS.Thickness, DETAILS.Width, DETAILS.Segments, DETAILS.Color, DETAILS.PreColor)
  1912. end
  1913. elseif DETAILS.Effect == "Portal" then
  1914. if PortalActive.Active == false then
  1915. PortalActive.Active = true
  1916. local place = DETAILS.CFrame
  1917. local tpEmitter = Instance.new("Part")
  1918. tpEmitter.Size = Vector3.new(0,0,0)
  1919. tpEmitter.Anchored = true
  1920. tpEmitter.Transparency = 1
  1921. tpEmitter.CanCollide = false
  1922. tpEmitter.CFrame = place
  1923. tpEmitter.Parent = workspace
  1924.  
  1925. local template = Instance.new("Part")
  1926. template.Size = Vector3.new(0,0,0)
  1927. template.Anchored = true
  1928. template.Material = "Neon"
  1929. local PortalPt = PartEmitter.new(tpEmitter, template)
  1930. PortalActive.Portal.PortalPt = PortalPt
  1931. PortalPt.Size = {
  1932. {
  1933. Time = 0,
  1934. Value = Vector3.new(0,0,0),
  1935. },
  1936. {
  1937. Time = 0.5,
  1938. Value = Vector3.new(25,25, 0.164),
  1939. Style = "Circular",
  1940. Direction = "Out"
  1941. },
  1942. {
  1943. Time = 1,
  1944. Value = Vector3.new(0,0,0),
  1945. Style = "Circular",
  1946. Direction = "In"
  1947. }
  1948. }
  1949. PortalPt.Color = ColorSequence.new({
  1950. ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
  1951. ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
  1952. ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
  1953. })
  1954. PortalPt.Lifetime = NumberRange.new(2,3)
  1955. PortalPt.Rate = 10
  1956. PortalPt.Speed = {
  1957. {
  1958. Time = 0,
  1959. x = 0,
  1960. y = 0,
  1961. z = 0,
  1962. },
  1963. {
  1964. Time = 1,
  1965. x = 0,
  1966. y = 0,
  1967. z = -0.05,
  1968. Style = "Circular",
  1969. Direction = "Out"
  1970. },
  1971. }
  1972. PortalPt.RotSpeed = {
  1973. {
  1974. Time = 0,
  1975. x = 0,
  1976. y = 0,
  1977. z = 0.5,
  1978. },
  1979. {
  1980. Time = 1,
  1981. x = 0,
  1982. y = 0,
  1983. z = 0.1,
  1984. Style = "Circular",
  1985. Direction = "InOut"
  1986. }
  1987. }
  1988. PortalPt.Transparency = NumberSequence.new({
  1989. NumberSequenceKeypoint.new(0,1,0),
  1990. NumberSequenceKeypoint.new(0.5,0,0),
  1991. NumberSequenceKeypoint.new(1,1,0)
  1992. })
  1993. PortalPt.Enabled = true
  1994. local connect
  1995. connect = game:GetService("RunService").RenderStepped:Connect(function()
  1996. if PortalPt.Emitter then
  1997. PortalPt.Emitter.CFrame = PortalPt.Emitter.CFrame * CFrame.Angles(0, 0, math.rad(-0.1))
  1998. else
  1999. connect:Disconnect()
  2000. end
  2001. end)
  2002.  
  2003. local wind = Instance.new("Part")
  2004. wind.Size = Vector3.new(20,20,3)
  2005. wind.Anchored = true
  2006. wind.Transparency = 1
  2007. wind.CanCollide = false
  2008. wind.CFrame = place * CFrame.new(0, 0, -3)
  2009. wind.Parent = workspace
  2010.  
  2011. local PortalPt = PartEmitter.new(wind, template)
  2012. PortalActive.Portal.WindPt = PortalPt
  2013. PortalPt.Size = {
  2014. {
  2015. Time = 0,
  2016. Value = Vector3.new(0,0,0),
  2017. },
  2018. {
  2019. Time = 0.5,
  2020. Value = Vector3.new(1,0.3,1)/2,
  2021. Style = "Circular",
  2022. Direction = "Out"
  2023. },
  2024. {
  2025. Time = 1,
  2026. Value = Vector3.new(0,0,0),
  2027. Style = "Circular",
  2028. Direction = "In"
  2029. }
  2030. }
  2031. PortalPt.Color = ColorSequence.new({
  2032. ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
  2033. ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
  2034. ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
  2035. })
  2036. PortalPt.Lifetime = NumberRange.new(1,3)
  2037. PortalPt.Rate = 5
  2038. PortalPt.Speed = {
  2039. {
  2040. Time = 0,
  2041. x = -0.5,
  2042. y = 0,
  2043. z = 0,
  2044. },
  2045. {
  2046. Time = 1,
  2047. x = -0.05,
  2048. y = 0,
  2049. z = 0,
  2050. Style = "Circular",
  2051. Direction = "Out"
  2052. },
  2053. }
  2054. PortalPt.RotSpeed = {
  2055. {
  2056. Time = 0,
  2057. x = 10,
  2058. y = 20,
  2059. z = 5,
  2060. },
  2061. {
  2062. Time = 1,
  2063. x = 0.5,
  2064. y = 0,
  2065. z = 0.5,
  2066. Style = "Circular",
  2067. Direction = "InOut"
  2068. }
  2069. }
  2070. PortalPt.Transparency = NumberSequence.new({
  2071. NumberSequenceKeypoint.new(0,1,0),
  2072. NumberSequenceKeypoint.new(0.5,0,0),
  2073. NumberSequenceKeypoint.new(1,1,0)
  2074. })
  2075. PortalPt.Enabled = true
  2076. elseif PortalActive.Active == true then
  2077. PortalActive.Active = false
  2078. if PortalActive.PortalPt ~= nil then
  2079. PortalActive.Portal.PortalPt:Destroy(true)
  2080. PortalActive.Portal.PortalPt.Emitter:Destroy()
  2081. PortalActive.Portal.WindPt:Destroy(true)
  2082. PortalActive.Portal.WindPt.Emitter:Destroy()
  2083. end
  2084. end
  2085. end
  2086. end
  2087.  
  2088. Ev.OnClientEvent:Connect(function(DETAILS)
  2089. handler(DETAILS)
  2090. end)
  2091.  
  2092. local function fauxPortal(where, size)
  2093. local place = where
  2094. local tpEmitter = Instance.new("Part")
  2095. tpEmitter.Size = Vector3.new(0,0,0)
  2096. tpEmitter.Anchored = true
  2097. tpEmitter.Transparency = 1
  2098. tpEmitter.CanCollide = false
  2099. tpEmitter.CFrame = place
  2100. tpEmitter.Parent = workspace
  2101.  
  2102. local template = Instance.new("Part")
  2103. template.Size = Vector3.new(0,0,0)
  2104. template.Anchored = true
  2105. template.Material = "Neon"
  2106. local PortalPt = PartEmitter.new(tpEmitter, template)
  2107. PortalPt.Size = {
  2108. {
  2109. Time = 0,
  2110. Value = Vector3.new(0,0,0),
  2111. },
  2112. {
  2113. Time = 0.5,
  2114. Value = Vector3.new(size,size, 0.164),
  2115. Style = "Circular",
  2116. Direction = "Out"
  2117. },
  2118. {
  2119. Time = 1,
  2120. Value = Vector3.new(0,0,0),
  2121. Style = "Circular",
  2122. Direction = "In"
  2123. }
  2124. }
  2125. PortalPt.Color = ColorSequence.new({
  2126. ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
  2127. ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
  2128. ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
  2129. })
  2130. PortalPt.Lifetime = NumberRange.new(2,3)
  2131. PortalPt.Rate = 5
  2132. PortalPt.Speed = {
  2133. {
  2134. Time = 0,
  2135. x = 0,
  2136. y = 0,
  2137. z = 0,
  2138. },
  2139. {
  2140. Time = 1,
  2141. x = 0,
  2142. y = 0,
  2143. z = -0.05,
  2144. Style = "Circular",
  2145. Direction = "Out"
  2146. },
  2147. }
  2148. PortalPt.RotSpeed = {
  2149. {
  2150. Time = 0,
  2151. x = 0,
  2152. y = 0,
  2153. z = 0.5,
  2154. },
  2155. {
  2156. Time = 1,
  2157. x = 0,
  2158. y = 0,
  2159. z = 0.1,
  2160. Style = "Circular",
  2161. Direction = "InOut"
  2162. }
  2163. }
  2164. PortalPt.Transparency = NumberSequence.new({
  2165. NumberSequenceKeypoint.new(0,1,0),
  2166. NumberSequenceKeypoint.new(0.5,0,0),
  2167. NumberSequenceKeypoint.new(1,1,0)
  2168. })
  2169. PortalPt.Enabled = true
  2170. local connect
  2171. connect = game:GetService("RunService").RenderStepped:Connect(function()
  2172. if PortalPt.Emitter then
  2173. PortalPt.Emitter.CFrame = PortalPt.Emitter.CFrame * CFrame.Angles(0, 0, math.rad(-0.1))
  2174. else
  2175. connect:Disconnect()
  2176. end
  2177. end)
  2178.  
  2179. local wind = Instance.new("Part")
  2180. wind.Size = Vector3.new(size,size,size/10)
  2181. wind.Anchored = true
  2182. wind.Transparency = 1
  2183. wind.CanCollide = false
  2184. wind.CFrame = place * CFrame.new(0, 0, -size/10)
  2185. wind.Parent = workspace
  2186.  
  2187. local PortalPt = PartEmitter.new(wind, template)
  2188. PortalPt.Size = {
  2189. {
  2190. Time = 0,
  2191. Value = Vector3.new(0,0,0),
  2192. },
  2193. {
  2194. Time = 0.5,
  2195. Value = Vector3.new(1,0.3,1)/2,
  2196. Style = "Circular",
  2197. Direction = "Out"
  2198. },
  2199. {
  2200. Time = 1,
  2201. Value = Vector3.new(0,0,0),
  2202. Style = "Circular",
  2203. Direction = "In"
  2204. }
  2205. }
  2206. PortalPt.Color = ColorSequence.new({
  2207. ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
  2208. ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
  2209. ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
  2210. })
  2211. PortalPt.Lifetime = NumberRange.new(1,3)
  2212. PortalPt.Rate = 5
  2213. PortalPt.Speed = {
  2214. {
  2215. Time = 0,
  2216. x = -0.5,
  2217. y = 0,
  2218. z = 0,
  2219. },
  2220. {
  2221. Time = 1,
  2222. x = -0.05,
  2223. y = 0,
  2224. z = 0,
  2225. Style = "Circular",
  2226. Direction = "Out"
  2227. },
  2228. }
  2229. PortalPt.RotSpeed = {
  2230. {
  2231. Time = 0,
  2232. x = 10,
  2233. y = 20,
  2234. z = 5,
  2235. },
  2236. {
  2237. Time = 1,
  2238. x = 0.5,
  2239. y = 0,
  2240. z = 0.5,
  2241. Style = "Circular",
  2242. Direction = "InOut"
  2243. }
  2244. }
  2245. PortalPt.Transparency = NumberSequence.new({
  2246. NumberSequenceKeypoint.new(0,1,0),
  2247. NumberSequenceKeypoint.new(0.5,0,0),
  2248. NumberSequenceKeypoint.new(1,1,0)
  2249. })
  2250. PortalPt.Enabled = true
  2251. end
  2252.  
  2253. fauxPortal(workspace.Memento.Parts:WaitForChild("HomePortal").CFrame * CFrame.Angles(math.rad(90), 0, 0), (workspace.Memento.Parts.HomePortal.Size.X+workspace.Memento.Parts.HomePortal.Size.Z)/2)
  2254. ]========]}
  2255.  
  2256. for _,v in pairs(game.Players:GetPlayers()) do
  2257. for _,vv in pairs(GoesInEveryone) do
  2258. if vv[1] == "local" then
  2259. NLS(vv[2], Plr.Character)
  2260. elseif vv[1] == "server" then
  2261. NS(vv[2], Plr.Character)
  2262. end
  2263. end
  2264. end
  2265.  
  2266. local function loadR6(CHARACTER)
  2267. local Players = game:GetService("Players")
  2268. local Plr = Players:GetPlayerFromCharacter()
  2269. local FalseChar = game.ReplicatedStorage:WaitForChild("DefaultCharacter"):Clone()
  2270. local PlayersCharacter = game.Players:GetCharacterAppearanceAsync(Plr.UserId):Clone()
  2271. local FaceID = (Plr.Character:WaitForChild("Head"):FindFirstChild("face") or {Texture = "http://www.roblox.com/asset/?id=144080495"}).Texture
  2272. local Accessories = {}
  2273. FalseChar:WaitForChild("Head"):WaitForChild("face").Texture = FaceID
  2274. FalseChar:SetPrimaryPartCFrame(Plr.Character:WaitForChild("HumanoidRootPart").CFrame)
  2275. for _, Prt in pairs(PlayersCharacter:GetDescendants()) do
  2276. if Prt:IsA("BodyColors") then
  2277. Prt.TorsoColor3 = Color3.new(0.7,0,1)
  2278. Prt.LeftLegColor = BrickColor.new("Black")
  2279. Prt.RightLegColor = BrickColor.new("Black")
  2280. Prt.HeadColor = BrickColor.new("New Yeller")
  2281. Prt.RightArmColor = BrickColor.new("New Yeller")
  2282. Prt.LeftArmColor = BrickColor.new("New Yeller")
  2283. table.insert(Accessories, Prt:Clone())
  2284. elseif Prt:IsA("Tool") then
  2285. table.insert(Accessories, Prt:Clone())
  2286. end
  2287. end
  2288. for _, Prt in pairs(Plr.Character:GetChildren()) do
  2289. Prt:Destroy()
  2290. end
  2291. for _, Prt in pairs(FalseChar:GetChildren()) do
  2292. Prt.Parent = Plr.Character
  2293. end
  2294. for _, Prt in pairs(Accessories) do
  2295. Prt.Parent = Plr.Character
  2296. end
  2297. for _,v in pairs(GoesInDefaultCharacter) do
  2298. if v[1] == "local" then
  2299. NLS(v[2], Plr.Character)
  2300. elseif v[1] == "server" then
  2301. NS(v[2], Plr.Character)
  2302. end
  2303. end
  2304. for _,v in pairs(GoesInDefaultCharacterHumanoid) do
  2305. if v[1] == "local" then
  2306. NLS(v[2], Plr.Character.Humanoid)
  2307. elseif v[1] == "server" then
  2308. NS(v[2], Plr.Character.Humanoid)
  2309. end
  2310. end
  2311. end
  2312.  
  2313. NLS(TOOLSCRIPT, tool)
  2314.  
  2315. loadR6(owner.Character)
  2316.  
  2317.  
  2318. local EffectsForwwarder = game.ReplicatedStorage["Effect Event"]
  2319. local portalActive = {Active = false, Portal = {Go = nil, Connection = nil}}
  2320. local debounce = {}
  2321.  
  2322. local newPortal = function(place)
  2323. local portalGo = Instance.new("Part")
  2324. portalGo.Anchored = true
  2325. portalGo.Size = Vector3.new(20,20,3)
  2326. portalGo.Transparency = 1
  2327. portalGo.CFrame = place
  2328. portalGo.Parent = workspace
  2329. portalActive.Portal.Go = portalGo
  2330. portalActive.Portal.Connection = portalGo.Touched:Connect(function(hit)
  2331. if hit.Parent:FindFirstChildOfClass("Humanoid") and not table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")) then
  2332. spawn(function()
  2333. table.insert(debounce, hit.Parent:FindFirstChildOfClass("Humanoid"))
  2334. wait(2)
  2335. table.remove(debounce, table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")))
  2336. end)
  2337. local char = hit.Parent
  2338. if game.Players:GetPlayerFromCharacter(char) then
  2339. EffectsForwwarder:FireClient(game.Players:GetPlayerFromCharacter(char), {Effect = "WorldOfMemento", Active = true})
  2340. end
  2341. local tps = game.Workspace.Memento.Spawns:GetChildren()
  2342. local selectedTp = tps[math.random(1,#tps)]
  2343. char.HumanoidRootPart.CFrame = selectedTp.CFrame * CFrame.new(0, selectedTp.Size.Y/1.9, 0)
  2344. end
  2345. end)
  2346. end
  2347.  
  2348. local portalHome = game.Workspace.Memento.Parts.HomePortal
  2349. portalHome.Touched:Connect(function(hit)
  2350. if hit.Parent:FindFirstChildOfClass("Humanoid") and not table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")) then
  2351. spawn(function()
  2352. table.insert(debounce, hit.Parent:FindFirstChildOfClass("Humanoid"))
  2353. wait(2)
  2354. table.remove(debounce, table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")))
  2355. end)
  2356. local char = hit.Parent
  2357. if game.Players:GetPlayerFromCharacter(char) then
  2358. EffectsForwwarder:FireClient(game.Players:GetPlayerFromCharacter(char), {Effect = "WorldOfMemento", Active = false})
  2359. end
  2360. local selectedTp = workspace.Base
  2361. char.HumanoidRootPart.CFrame = selectedTp.CFrame * CFrame.new(0, selectedTp.Size.Y/1.9, 0)
  2362. end
  2363. end)
  2364.  
  2365. EffectsForwwarder.OnServerEvent:Connect(function(Player, DETAILS)
  2366. EffectsForwwarder:FireAllClients(DETAILS)
  2367. if DETAILS.Effect == "Portal" then
  2368. if portalActive.Active == true then
  2369. portalActive.Active = false
  2370. portalActive.Portal.Go:Destroy()
  2371. portalActive.Portal.Connection:Disconnect()
  2372. elseif portalActive.Active == false then
  2373. portalActive.Active = true
  2374. newPortal(DETAILS.CFrame)
  2375. end
  2376. end
  2377. end)
  2378.  
  2379.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement