Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local asset = LoadAssets(18880416072):GetDictionary()
- local memento = asset.Memento
- memento.Parent = workspace
- asset.Effects.Parent = workspace
- asset.DefaultCharacter.Parent = game.ReplicatedStorage
- asset.Glint.Parent = game.ReplicatedStorage
- tool = asset["Portal Wand"]
- tool.Parent = owner.Backpack
- local TOOLSCRIPT = {"local", [[local Ev = game.ReplicatedStorage:WaitForChild("Effect Event")
- local plr = game.Players.LocalPlayer
- local mouse = plr:GetMouse()
- local enabled = false
- script.Parent.Activated:Connect(function()
- Ev:FireServer({Effect = "Portal", CFrame = CFrame.new(mouse.Hit.p, plr.Character.HumanoidRootPart.Position)})
- end)]]}
- local GoesInDefaultCharacter = {
- Animate = {"local", [[
- wait(1)
- local Figure = script.Parent
- local Torso = Figure:WaitForChild("Torso")
- local RightShoulder = Torso:WaitForChild("Right Shoulder")
- local LeftShoulder = Torso:WaitForChild("Left Shoulder")
- local RightHip = Torso:WaitForChild("Right Hip")
- local LeftHip = Torso:WaitForChild("Left Hip")
- local Neck = Torso:WaitForChild("Neck")
- local Humanoid = Figure:WaitForChild("Humanoid")
- local pose = "None"
- local toolAnim = "None"
- local toolAnimTime = 0
- function onRunning(speed)
- if Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
- pose = "Running"
- else
- pose = "None"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- pose = "Jumping"
- end
- function onClimbing()
- pose = ("Climbing")
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "None"
- end
- function moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = 3.14 / 2
- LeftShoulder.DesiredAngle = -3.14 / 2
- RightHip.DesiredAngle = 3.14 / 2
- LeftHip.DesiredAngle = -3.14 / 2
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then
- return kid
- end
- end
- return nil
- end
- function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- RightShoulder.DesiredAngle = 1.57
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1.57
- LeftShoulder.DesiredAngle = 1.0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 1.0
- return
- end
- end
- function move()
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- local climbFudge = 0
- if (pose == "Running") then
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- amplitude = 1
- frequency = 9
- elseif (pose == "Climbing") then
- amplitude = 1
- frequency = 9
- climbFudge = 3.14
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- else
- amplitude = 0.1
- frequency = 1
- end
- desiredAngle = amplitude * math.sin(time() * frequency)
- RightShoulder.DesiredAngle = desiredAngle + climbFudge
- LeftShoulder.DesiredAngle = desiredAngle - climbFudge
- RightHip.DesiredAngle = -desiredAngle
- LeftHip.DesiredAngle = -desiredAngle
- local tool = getTool()
- if tool and tool.Handle then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- animStringValueObject.Parent = nil
- toolAnimTime = time() + .3
- end
- if time() > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- local runService = game:service("RunService")
- game:GetService("RunService").Heartbeat:connect(function()
- move()
- end)
- --All sounds are referenced by this ID
- local SFX = {
- Died = 0;
- Running = 1;
- Swimming = 2;
- Climbing = 3,
- Jumping = 4;
- GettingUp = 5;
- FreeFalling = 6;
- FallingDown = 7;
- Landing = 8;
- Splash = 9;
- }
- local Humanoid = nil
- local Head = nil
- --SFX ID to Sound object
- local Sounds = {}
- local SoundService = game:GetService("SoundService")
- local soundEventFolderName = "DefaultSoundEvents"
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local AddCharacterLoadedEvent = nil
- local RemoveCharacterEvent = nil
- local soundEventFolder = ReplicatedStorage:FindFirstChild(soundEventFolderName)
- if not soundEventFolder then
- soundEventFolder = Instance.new("Folder", ReplicatedStorage)
- soundEventFolder.Name = soundEventFolderName
- soundEventFolder.Archivable = false
- end
- -- Load the RemoveCharacterEvent
- RemoveCharacterEvent = soundEventFolder:FindFirstChild("RemoveCharacterEvent")
- if RemoveCharacterEvent == nil then
- RemoveCharacterEvent = Instance.new("RemoteEvent", soundEventFolder)
- RemoveCharacterEvent.Name = "RemoveCharacterEvent"
- end
- AddCharacterLoadedEvent = soundEventFolder:FindFirstChild("AddCharacterLoadedEvent")
- if AddCharacterLoadedEvent == nil then
- AddCharacterLoadedEvent = Instance.new("RemoteEvent", soundEventFolder)
- AddCharacterLoadedEvent.Name = "AddCharacterLoadedEvent"
- end
- -- Notify the server a new character has been loaded
- AddCharacterLoadedEvent:FireServer()
- -- Notify the sound dispatcher this character has left.
- game.Players.LocalPlayer.CharacterRemoving:connect(function(character)
- RemoveCharacterEvent:FireServer(game.Players.LocalPlayer)
- end)
- do
- local Figure = script.Parent.Parent
- Head = Figure:WaitForChild("Head")
- while not Humanoid do
- for _,NewHumanoid in pairs(Figure:GetChildren()) do
- if NewHumanoid:IsA("Humanoid") then
- Humanoid = NewHumanoid
- break
- end
- end
- if Humanoid then break end
- Figure.ChildAdded:wait()
- end
- Sounds[SFX.Died] = Head:WaitForChild("Died")
- Sounds[SFX.Running] = Head:WaitForChild("Running")
- Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
- Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
- Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
- Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
- Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
- Sounds[SFX.Landing] = Head:WaitForChild("Landing")
- Sounds[SFX.Splash] = Head:WaitForChild("Splash")
- local DefaultServerSoundEvent = soundEventFolder:FindFirstChild("DefaultServerSoundEvent")
- if DefaultServerSoundEvent then
- DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
- if resetPosition and sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if sound.IsPlaying ~= playing then
- sound.Playing = playing
- end
- end)
- end
- end
- local IsSoundFilteringEnabled = function()
- return false --game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled
- end
- local Util
- Util = {
- --Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
- YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
- --(y - y1)/(x - x1) = m
- local m = (pt1y - pt2y) / (pt1x - pt2x)
- --float b = pt1.y - m * pt1.x;
- local b = (pt1y - m * pt1x)
- return m * x + b
- end;
- --Clamps the value of "val" between the "min" and "max"
- Clamp = function(val,min,max)
- return math.min(max,math.max(min,val))
- end;
- --Gets the horizontal (x,z) velocity magnitude of the given part
- HorizontalSpeed = function(Head)
- local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
- return hVel.magnitude
- end;
- --Gets the vertical (y) velocity magnitude of the given part
- VerticalSpeed = function(Head)
- return math.abs(Head.Velocity.Y)
- end;
- --Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
- --If these properties are enabled, use them.
- Play = function(sound)
- if IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(true, true)
- end
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Pause = function(sound)
- if IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(false, false)
- end
- if sound.IsPlaying then
- sound.Playing = false
- end
- end;
- Resume = function(sound)
- if IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(true, false)
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Stop = function(sound)
- if IsSoundFilteringEnabled() then
- sound.CharacterSoundEvent:FireServer(false, true)
- end
- if sound.IsPlaying then
- sound.Playing = false
- end
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- end;
- }
- do
- -- List of all active Looped sounds
- local playingLoopedSounds = {}
- -- Last seen Enum.HumanoidStateType
- local activeState = nil
- local fallSpeed = 0
- -- Verify and set that "sound" is in "playingLoopedSounds".
- function setSoundInPlayingLoopedSounds(sound)
- for i=1, #playingLoopedSounds do
- if playingLoopedSounds[i] == sound then
- return
- end
- end
- table.insert(playingLoopedSounds,sound)
- end
- -- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
- function stopPlayingLoopedSoundsExcept(except)
- for i=#playingLoopedSounds,1,-1 do
- if playingLoopedSounds[i] ~= except then
- Util.Pause(playingLoopedSounds[i])
- table.remove(playingLoopedSounds,i)
- end
- end
- end
- -- Table of Enum.HumanoidStateType to handling function
- local stateUpdateHandler = {
- [Enum.HumanoidStateType.Dead] = function()
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.Died]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.RunningNoPhysics] = function(speed)
- stateUpdated(Enum.HumanoidStateType.Running, speed)
- end;
- [Enum.HumanoidStateType.Running] = function(speed)
- local sound = Sounds[SFX.Running]
- stopPlayingLoopedSoundsExcept(sound)
- if(activeState == Enum.HumanoidStateType.Freefall and fallSpeed > 0.1) then
- -- Play a landing sound if the character dropped from a large distance
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- local freeFallSound = Sounds[SFX.FreeFalling]
- freeFallSound.Volume = vol
- Util.Play(freeFallSound)
- fallSpeed = 0
- end
- if speed ~= nil and speed > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- elseif speed ~= nil then
- stopPlayingLoopedSoundsExcept()
- end
- end;
- [Enum.HumanoidStateType.Swimming] = function(speed)
- local threshold = speed
- if activeState ~= Enum.HumanoidStateType.Swimming and threshold > 0.1 then
- local splashSound = Sounds[SFX.Splash]
- splashSound.Volume = Util.Clamp(
- Util.YForLineGivenXAndTwoPts(
- Util.VerticalSpeed(Head),
- 100, 0.28,
- 350, 1),
- 0,1)
- Util.Play(splashSound)
- end
- do
- local sound = Sounds[SFX.Swimming]
- stopPlayingLoopedSoundsExcept(sound)
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- end
- end;
- [Enum.HumanoidStateType.Climbing] = function(speed)
- local sound = Sounds[SFX.Climbing]
- if speed ~= nil and math.abs(speed) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- Util.Pause(sound)
- stopPlayingLoopedSoundsExcept(sound)
- end
- setSoundInPlayingLoopedSounds(sound)
- end;
- [Enum.HumanoidStateType.Jumping] = function()
- if activeState == Enum.HumanoidStateType.Jumping then
- return
- end
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.Jumping]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.GettingUp] = function()
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.GettingUp]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.Freefall] = function()
- if activeState == Enum.HumanoidStateType.Freefall then
- return
- end
- local sound = Sounds[SFX.FreeFalling]
- sound.Volume = 0
- stopPlayingLoopedSoundsExcept()
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.y))
- end;
- [Enum.HumanoidStateType.FallingDown] = function()
- stopPlayingLoopedSoundsExcept()
- end;
- [Enum.HumanoidStateType.Landed] = function()
- stopPlayingLoopedSoundsExcept()
- if Util.VerticalSpeed(Head) > 75 then
- local landingSound = Sounds[SFX.Landing]
- landingSound.Volume = Util.Clamp(
- Util.YForLineGivenXAndTwoPts(
- Util.VerticalSpeed(Head),
- 50, 0,
- 100, 1),
- 0,1)
- Util.Play(landingSound)
- end
- end;
- [Enum.HumanoidStateType.Seated] = function()
- stopPlayingLoopedSoundsExcept()
- end;
- }
- -- Handle state event fired or OnChange fired
- function stateUpdated(state, speed)
- if stateUpdateHandler[state] ~= nil then
- if (state == Enum.HumanoidStateType.Running
- or state == Enum.HumanoidStateType.Climbing
- or state == Enum.HumanoidStateType.Swimming
- or state == Enum.HumanoidStateType.RunningNoPhysics) then
- stateUpdateHandler[state](speed)
- else
- stateUpdateHandler[state]()
- end
- end
- activeState = state
- end
- Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
- Humanoid.Running:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Running, speed) end)
- Humanoid.Swimming:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Swimming, speed) end)
- Humanoid.Climbing:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Climbing, speed) end)
- Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
- Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
- Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
- Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
- -- required for proper handling of Landed event
- Humanoid.StateChanged:connect(function(old, new)
- stateUpdated(new)
- end)
- function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
- local stepScale = stepDeltaSeconds / tickSpeedSeconds
- do
- local sound = Sounds[SFX.FreeFalling]
- if activeState == Enum.HumanoidStateType.Freefall then
- if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
- Util.Resume(sound)
- --Volume takes 1.1 seconds to go from volume 0 to 1
- local ANIMATION_LENGTH_SECONDS = 1.1
- local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
- sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
- else
- sound.Volume = 0
- end
- else
- Util.Pause(sound)
- end
- end
- do
- local sound = Sounds[SFX.Running]
- if activeState == Enum.HumanoidStateType.Running then
- if Util.HorizontalSpeed(Head) < 0.5 then
- Util.Pause(sound)
- end
- end
- end
- end
- local lastTick = tick()
- local TICK_SPEED_SECONDS = 0.25
- while true do
- onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
- lastTick = tick()
- wait(TICK_SPEED_SECONDS)
- end
- end
- ]]},
- Health = {"server", [[
- local Character = script.Parent
- local Humanoid = Character:WaitForChild("Humanoid")
- while true do
- if Humanoid.Health < Humanoid.MaxHealth then
- Humanoid.Health = math.min(Humanoid.Health + 0.1*Humanoid.MaxHealth, Humanoid.MaxHealth)
- wait(1)
- end
- Humanoid.HealthChanged:Wait()
- end]]},
- Sound = {
- "server",
- [[
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Players = game:GetService("Players")
- local SOUND_EVENT_FOLDER_NAME = "DefaultSoundEvents"
- local DEFAULT_SERVER_SOUND_EVENT_NAME = "DefaultServerSoundEvent"
- local SoundEventFolder = ReplicatedStorage:FindFirstChild(SOUND_EVENT_FOLDER_NAME)
- local DefaultServerSoundEvent = nil
- if not SoundEventFolder then
- SoundEventFolder = Instance.new("Folder")
- SoundEventFolder.Name = SOUND_EVENT_FOLDER_NAME
- SoundEventFolder.Archivable = false
- SoundEventFolder.Parent = ReplicatedStorage
- end
- DefaultServerSoundEvent = SoundEventFolder:FindFirstChild(DEFAULT_SERVER_SOUND_EVENT_NAME)
- if not DefaultServerSoundEvent then
- DefaultServerSoundEvent = Instance.new("RemoteEvent", SoundEventFolder)
- DefaultServerSoundEvent.Name = DEFAULT_SERVER_SOUND_EVENT_NAME
- DefaultServerSoundEvent.OnServerEvent:Connect(function(plr, mm,mmm) print(mm,mmm) end)
- end
- local function CreateNewSound(name, id, looped, pitch, parent)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.Archivable = false
- sound.Pitch = pitch
- sound.Looped = looped
- sound.MinDistance = 5
- sound.MaxDistance = 150
- sound.Volume = 0.65
- sound.Parent = parent
- --if DefaultServerSoundEvent then
- local CharacterSoundEvent = Instance.new("RemoteEvent", sound)
- CharacterSoundEvent.Name = "CharacterSoundEvent"
- CharacterSoundEvent.OnServerEvent:Connect(function(player, playing, resetPosition)
- if type(playing) ~= "boolean" then
- return
- end
- if type(resetPosition) ~= "boolean" then
- return
- end
- if player.Character ~= script.Parent then
- return
- end
- for _, p in pairs(Players:GetPlayers()) do
- if p ~= player then
- -- Connect to the dispatcher to check if the player has loaded.
- SoundEventFolder:FindFirstChild("SoundDispatcher"):Fire(p, sound, playing, resetPosition)
- end
- end
- end)
- --end
- return sound
- end
- local head = script.Parent:FindFirstChild("Head")
- if not head then
- error("Sound script parent has no child Head.")
- return
- end
- CreateNewSound("GettingUp", "rbxasset://sounds/hit.wav", false, 1, head)
- CreateNewSound("Died", "rbxasset://sounds/uuhhh.mp3", false, 1, head)
- CreateNewSound("FreeFalling", "", true, 1, head)
- CreateNewSound("Jumping", "rbxassetid://7218305705", false, 1, head)
- CreateNewSound("Landing", "", false, 1, head)
- CreateNewSound("Splash", "", false, 1, head)
- CreateNewSound("Running", "rbxasset://sounds/bfsl-minifigfoots1.mp3", true, 1, head)
- CreateNewSound("Swimming", "", true, 1.6, head)
- CreateNewSound("Climbing", "", true, 1, head)
- ]]
- },
- }
- GoesInDefaultCharacterHumanoid = {
- Respawn = {
- "server",
- [[script.Parent.Died:Connect(function()
- game.ReplicatedStorage["Effect Event"]:FireClient(game.Players:WaitForChild(script.Parent.Parent.Name), {Effect ="WorldOfMemento", Active = false, Died = true})
- wait(5)
- game.Players:WaitForChild(script.Parent.Parent.Name):LoadCharacter()
- end)]]
- },
- Jump = {
- "local",
- [[local Mouse = game.Players.LocalPlayer:GetMouse()
- Mouse.KeyDown:connect(function(Key)
- if Key == " " then
- local Active = true
- local Connection = Mouse.KeyUp:connect(function(Key)
- if Key == " " then
- Active = false
- end
- end)
- while Active do
- script.Parent.Jump = true
- wait()
- end
- Connection:Disconnect()
- end
- end)]]
- }
- }
- local Event = game.ReplicatedStorage:FindFirstChild("Effect Event") or Instance.new("RemoteEvent", game.ReplicatedStorage)
- Event.Name = "Effect Event"
- GoesInEveryone = {
- "local",
- [========[
- --!native
- --[[
- ModulePack
- (c) OCbwoy3 2024-present
- --]]
- local print_, warn_ = print, warn
- local print = printf or print_
- local warn = warnf or warn_
- local _loadstringEnabled, _ = pcall(function()return loadstring("return true") end)
- if not _loadstringEnabled then error("[MODULEPACK] Loadsting is disabled.",0) end
- local onls = require(16899242601)()
- local LSCache = {}
- local NLS = function(a) local x = onls(a) LSCache[x]=a return x end
- local ModuleTree = Instance.new("Folder")
- ModuleTree.Name = "ModulePack"
- ModuleTree.Parent=nil
- local Modules, RequireCache = {}, {}
- 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
- 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
- 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
- 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
- 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
- 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
- local buildStartTime = tick()
- __modulepack_define("ModulePack.MainEffects","ModuleScript")
- __modulepack_define("ModulePack.MainEffects.PartEmitter","ModuleScript")
- __modulepack_define("ModulePack.MainEffects.PartEmitter.UniqueIDGenerator","ModuleScript")
- __modulepack_define("ModulePack.MainEffects.PartEmitter.PartCache","ModuleScript")
- __modulepack_define("ModulePack.MainEffects.PartEmitter.PartCache.Table","ModuleScript")
- __modulepack_code("ModulePack.MainEffects",[=====[local module = {}
- local storedParims = {}
- local cache = require(script.PartEmitter.PartCache)
- local glitterColors = {Color3.new(1,0.5,1), Color3.new(1,1,0.5), Color3.new(0.5,1,0.8)}
- --------------------------------------------------------------
- local function make(inst, details, parent)
- local Item = Instance.new(inst)
- if details then
- for i,v in pairs(details) do
- Item[i] = v
- end
- end
- Item.Parent = parent or nil
- return Item
- end
- local function change(item, changes)
- for i,v in pairs(changes) do
- if item:FindFirstChild(i) and typeof(v) == "table" then
- change(item[i], v)
- else
- item[i] = v
- end
- end
- return item
- end
- local function Tween(Obj, Dir, Style, Duration, Goal, Reverses, DelayTime, onEnding)
- local tweenService = game:GetService("TweenService")
- local tweenInfo = TweenInfo.new(
- Duration,
- Enum.EasingStyle[Style],
- Enum.EasingDirection[Dir],
- 0,
- Reverses or false,
- DelayTime or 0
- )
- local tween = tweenService:Create(Obj,tweenInfo,Goal)
- spawn(function()
- tween:Play()
- end)
- if onEnding then
- tween.Completed:Connect(function()
- onEnding()
- end)
- end
- return tween
- end
- local function QuadraticBezier(t,p0,p1,p2)
- return (1-t)^2*p0+2*(1-t)*t*p1+t^2*p2;
- end
- local function storeParims(name, details)
- local newSet = {}
- for i,v in pairs(details) do
- newSet[i] = v
- end
- storedParims[name] = newSet
- end
- local function resetParims(item, setName)
- if storedParims[setName] then
- change(item, storedParims[setName])
- end
- return item
- end
- -------------------------------------------------------------
- local neonPart = make("Part", {Material = "Neon", Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
- neonPart:SetAttribute("PartType", "NeonPart")
- storeParims("NeonDefault", {Material = "Neon", Transparency = 0, Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
- local neonModel = workspace:FindFirstChild("Effects"):FindFirstChild("Neon")
- local neonCache = cache.new(neonPart, 1000, neonModel)
- ---
- local spherePart = make("Part", {Material = "Neon", Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
- spherePart:SetAttribute("PartType", "SpherePart")
- storeParims("SphereDefault", {Material = "Neon", Transparency = 0, Anchored = true, CanCollide = false, Size = Vector3.new(1,1,1)})
- local sphereMesh = make("SpecialMesh", {MeshType = "Sphere"}, spherePart)
- local sphereModel = workspace:FindFirstChild("Effects"):FindFirstChild("Sphere")
- local sphereCache = cache.new(spherePart, 1000, sphereModel)
- ---
- local ring = script.ShockRing:Clone()
- ring:SetAttribute("PartType", "RingPart")
- storeParims("RingDefault", {Material = "Neon", Transparency = .35, Anchored = true, CanCollide = false, Size = Vector3.new(6.4, 6.4, 0.164)})
- local RingModel = workspace:FindFirstChild("Effects"):FindFirstChild("AdvancedParts")
- local ringCache = cache.new(ring, 300, RingModel)
- --========================
- local getPart = function(typeOf, preset)
- local SelectedCache
- local preset
- if typeOf == "RingPart" then
- preset = preset or "RingDefault"
- SelectedCache = ringCache
- elseif typeOf == "SpherePart" then
- preset = preset or "SphereDefault"
- SelectedCache = sphereCache
- else
- preset = preset or "NeonDefault"
- SelectedCache = neonCache
- end
- return resetParims(SelectedCache:GetPart(), preset)
- end
- local returnPart = function(part, duration)
- local typeOf = part:GetAttribute("PartType")
- local SelectedCache
- if typeOf == "NeonPart" then
- SelectedCache = neonCache
- elseif typeOf == "RingPart" then
- SelectedCache = ringCache
- elseif typeOf == "SpherePart" then
- SelectedCache = sphereCache
- end
- if duration then
- task.wait(duration)
- SelectedCache:ReturnPart(part)
- else
- SelectedCache:ReturnPart(part)
- end
- end
- -------------------------------------------------------------
- module.Star = function(place, duration, size, color: ColorSequence)
- local glint = game.ReplicatedStorage.Glint:Clone()
- local size = size or 0
- glint.Anchored = true
- glint.CFrame = place
- for _,v in pairs(glint:GetChildren()) do
- v.Squash = NumberSequence.new(-(40+size), 40+size)
- v.Color = color
- v.Rate = v.Rate*2
- v.RotSpeed = NumberRange.new(-.1,.1)
- v.Enabled = true
- end
- glint.Parent = workspace.Effects.AdvancedParts
- for _,v in pairs(glint:GetChildren()) do
- v:Emit(50)
- end
- local waiting = true
- spawn(function()
- repeat wait(math.random(1, 5)/10)
- if waiting then
- spawn(function()
- local bolt = module.LightningStrike(place,
- place*CFrame.new(math.random(-20, 20), math.random(-20, 20),math.random(-20, 20)),
- math.random(1,5)/10,
- math.random(1, 3),
- math.random(2,4),
- color.Keypoints[1].Value,
- color.Keypoints[2].Value)
- end)
- end
- until not waiting
- end)
- spawn(function()
- wait(duration)
- for _,v in pairs(glint:GetChildren()) do
- v.Enabled = false
- end
- game.Debris:AddItem(glint, 5.5)
- waiting = false
- return true
- end)
- end
- module.LightningStrike = function(startcf, endcf, thickness, width, segments, color, pre_col)
- local color = color or Color3.new(1,0.9,0.5)
- local pre_col = pre_col or Color3.new(1,1,1)
- local segments = segments or 5
- local points = {}
- for i = 1, segments do
- local cf = startcf:Lerp(endcf, i/segments)
- if i ~= 1 and i~= segments then
- cf = cf * CFrame.new(math.random(-width, width), math.random(-width, width), math.random(-width, width))
- end
- points[i] = cf
- end
- table.insert(points, 1, startcf)
- local inuse = {}
- local straight = function(point1, point2)
- local midpoint = (point1.Position + point2.Position) / 2
- local distance = (point1.Position - point2.Position).Magnitude
- local part = getPart("NeonPart")
- part.Size = Vector3.new(thickness, thickness, distance)
- part.Color = pre_col
- part.CFrame = CFrame.new(midpoint, point2.Position)
- table.insert(inuse, part)
- local ballPart = getPart("SpherePart")
- ballPart.Size = Vector3.new(thickness, thickness, thickness)
- ballPart.CFrame = point1
- table.insert(inuse, ballPart)
- local ballPart = getPart("SpherePart")
- ballPart.Size = Vector3.new(thickness, thickness, thickness)
- ballPart.CFrame = point2
- table.insert(inuse, ballPart)
- end
- local erratic = function(point1, point2)
- local newPointsList = {}
- for i = 1, math.clamp(segments * (math.random(10, 15)/10), 5, 10) do
- local point = point1:Lerp(point2, i/segments)
- 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)
- end
- table.insert(newPointsList, 1, point1)
- for i,v in pairs(newPointsList) do
- if i ~= #newPointsList then
- straight(v, newPointsList[i+1])
- end
- end
- end
- local curved = function(point1, point2)
- local newPointsList = {}
- local curveSegments = math.clamp(segments * (math.random(10, 15)/10), 5, 10)
- local midpoint = point1:Lerp(point2, 0.5)
- midpoint = midpoint:Lerp(midpoint * CFrame.new(math.random(-width, width)*3, math.random(-width, width)*3, math.random(-width, width)*3), 1).Position
- for i = 1, curveSegments do
- newPointsList[i] = CFrame.new(QuadraticBezier(i/curveSegments, point1.Position, midpoint, point2.Position))
- end
- table.insert(newPointsList, 1, point1)
- for i,v in pairs(newPointsList) do
- if i ~= #newPointsList then
- straight(v, newPointsList[i+1])
- end
- end
- end
- for i,v in pairs(points) do
- if i ~= #points then
- local random = math.random(1,3)
- if random == 1 then
- straight(v, points[i+1])
- elseif random == 2 then
- curved(v, points[i+1])
- else
- erratic(v, points[i+1])
- end
- end
- end
- for i,v in pairs(inuse) do
- local endSize
- if v:GetAttribute("PartType") == "SpherePart" then
- endSize = Vector3.new()
- else
- endSize = Vector3.new(0,0,v.Size.Z)
- end
- Tween(v, "Out", "Circular", math.random(2, 5)/10, {Color = color, Size = endSize, Transparency = 1}, false, 0, function()
- returnPart(v)
- table.remove(inuse, 1)
- end)
- end
- repeat wait() until #inuse == 0
- print("Completed Lightning Bolt")
- end
- module.Burst = function(cframe, scale, color, pre_col)
- local color = color or Color3.new(.8,.8,.8)
- local pre_col = pre_col or color
- local scale = scale or 1
- local inuse = {}
- local currentPart = getPart("SpherePart")
- currentPart.Color = pre_col
- currentPart.Size = Vector3.new(0,0,0):Lerp(Vector3.new(7, 30, 7), scale)
- currentPart.CFrame = cframe
- table.insert(inuse, currentPart)
- if scale >= 3 then
- local ring = getPart("RingPart")
- ring.Color = pre_col:Lerp(Color3.new(1,1,1), 0.5)
- ring.Size = Vector3.new(0,0,0):Lerp(Vector3.new(11, 11, 0.164), scale)
- ring.CFrame = cframe * CFrame.Angles(math.rad(90), 0, 0)
- 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()
- returnPart(ring)
- end)
- local ring = getPart("RingPart")
- ring.Color = pre_col:Lerp(Color3.new(1,1,1), 0.5)
- ring.Size = Vector3.new(0,0,0):Lerp(Vector3.new(8, 8, 0.164), scale)
- ring.CFrame = cframe * CFrame.new(0, currentPart.Size.Y/4, 0) * CFrame.Angles(math.rad(90), 0, 0)
- 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()
- returnPart(ring)
- end)
- end
- for i = 1, math.random(6,8) do
- local newBigPart = getPart("SpherePart")
- newBigPart.Color = pre_col
- newBigPart.Size = Vector3.new(0,0,0):Lerp(Vector3.new(3, 10, 3), scale)
- newBigPart.CFrame = cframe:Lerp(cframe * CFrame.new(math.random(-3, 3), math.random(-7, 10), math.random(-3, 3)), scale)
- table.insert(inuse, newBigPart)
- end
- for i = 1, 10 do
- local newSmallPart = getPart("SpherePart")
- newSmallPart.Color = pre_col
- newSmallPart.Size = Vector3.new(0,0,0):Lerp(Vector3.new(1,4,1), scale)
- newSmallPart.CFrame = cframe:Lerp(cframe * CFrame.new(math.random(-5, 5), math.random(-10, 10), math.random(-5, 5)), scale)
- table.insert(inuse, newSmallPart)
- end
- for i = 1, 20 do
- local glitterParts = getPart("SpherePart")
- glitterParts.Size = Vector3.new(0,0,0):Lerp(Vector3.new(0.5,1.5,0.5), scale) * math.random(1,10)/10
- glitterParts.Color = (glitterColors)[math.random(1,#glitterColors)]
- glitterParts.CFrame = cframe:Lerp(cframe * CFrame.new(math.random(-5, 5), math.random(-15, 15), math.random(-5, 5)), scale)
- table.insert(inuse, glitterParts)
- end
- for i,v in pairs(inuse) do
- 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()
- 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()
- returnPart(v)
- table.remove(inuse, 1)
- end)
- end)
- end
- repeat wait() until #inuse == 0
- print("Completed Sea Burst")
- end
- module.FOVChange = function(camera, newFOV, correctOnEnd, duration, style, dir)
- local NEW_FOV
- local OLD_FOV
- if newFOV and typeof(newFOV) == "table" then
- NEW_FOV = newFOV.NEW_FOV
- OLD_FOV = newFOV.OLD_FOV
- else
- NEW_FOV = newFOV
- OLD_FOV = 70
- end
- if dir == "OutIn" then
- Tween(camera, "In", style or "Circular", duration/2 or 0.5, {FieldOfView = (OLD_FOV + NEW_FOV)/2}, false, 0, function()
- Tween(camera, "Out", style or "Circular", duration/2 or 0.5, {FieldOfView = NEW_FOV}, false, 0, function()
- if correctOnEnd then
- camera.FieldOfView = OLD_FOV
- end
- end)
- end)
- else
- Tween(camera, dir or "InOut", style or "Circular", duration or 1, {FieldOfView = NEW_FOV}, false, 0, function()
- if correctOnEnd then
- camera.FieldOfView = OLD_FOV
- end
- end)
- end
- end
- module.Tween = function(...)
- Tween(...)
- end
- return module
- ]=====])
- __modulepack_code("ModulePack.MainEffects.PartEmitter",[=====[local PartEmitterModule = {}
- local UniqueIdGenerator = require(script.UniqueIDGenerator)
- local PartCacheModule = require(script.PartCache)
- PartEmitterModule.__index = PartEmitterModule
- local actives = {}
- export type PartEmitter = {
- Template: BasePart,
- Emitter: BasePart,
- Transparency: NumberSequence,
- Color: ColorSequence,
- EmissionDirection: string,
- Enabled: boolean,
- Rate: number,
- LockedToPart: boolean,
- CanCollide: boolean,
- TimeScale: number,
- CastShadow: boolean,
- WindAffectsDrag: boolean,
- ShapeStyle: string,
- Lifetime: NumberRange,
- Speed: {[number]: {
- x: number,
- y: number,
- z: number,
- Direction: string,
- Style: string,
- Time: number}
- },
- RotSpeed: {[number]: {
- x: number,
- y: number,
- z: number,
- Time: number}
- },
- Size: {[number]: {
- Value: Vector3,
- Time: number,
- Direction: string,
- Style: string}
- },
- Offset: {[number]: {
- Value: Vector3,
- Time: number}
- },
- }
- local function Tween(Obj, Dir, Style, Duration, Goal, Reverses, DelayTime, onEnding)
- local tweenService = game:GetService("TweenService")
- local tweenInfo = TweenInfo.new(
- Duration,
- Enum.EasingStyle[Style],
- Enum.EasingDirection[Dir],
- 0,
- Reverses or false,
- DelayTime or 0
- )
- local tween = tweenService:Create(Obj,tweenInfo,Goal)
- spawn(function()
- tween:Play()
- end)
- if onEnding then
- tween.Completed:Connect(function()
- onEnding()
- end)
- end
- return tween
- end
- function PartEmitterModule.new(Emitter: BasePart, Template: BasePart, StartParts: number): PartEmitter
- local PtTemplate = Template or Instance.new("Part")
- local PtFolder = workspace.Terrain:FindFirstChild("PartEmitterFolder") or Instance.new("Folder", workspace.Terrain)
- if PtFolder.Name ~= "PartEmitterFolder" then
- PtFolder.Name = "PartEmitterFolder"
- end
- if PtTemplate.Anchored ~= true then
- PtTemplate.Anchored = true
- end
- local newCache = PartCacheModule.new(PtTemplate, StartParts or 200, PtFolder)
- newCache.ExpansionSize = 100
- local object: PartEmitter = {
- Emitter = Emitter,
- Template = PtTemplate or Instance.new("Part"),
- Transparency = NumberSequence.new(0, 1),
- Color = ColorSequence.new(Color3.new(1,1,1)),
- EmissionDirection = "Top",
- Enabled = false,
- ShapeStyle = "Volume",
- CanCollide = false,
- CastShadow = false,
- Rate = 1,
- Lifetime = NumberRange.new(1,3),
- Speed = {
- {
- x = 0,
- y = 0.1,
- z = 0,
- Time = 0,
- },
- {
- x = 0,
- y = 1,
- z = 0,
- Time = 1,
- Direction = "Out",
- Style = "Circular",
- }
- },
- RotSpeed = {
- {
- x = 0,
- y = 1,
- z = 0,
- Time = 0,
- },
- {
- x = 0,
- y = 10,
- z = 0,
- Time = 1,
- Direction = "InOut",
- Style = "Linear",
- }
- },
- Size = {
- {
- Value = Vector3.new(5,5,5),
- Time = 0
- },
- {
- Value = Vector3.new(10,5,10),
- Time = 1,
- Direction = "Out",
- Style = "Cubic"
- }
- },
- Offset = {
- {
- Value = Vector3.new(0,0,0),
- Time = 0
- },
- {
- Value = Vector3.new(0,0,0),
- Time = 1,
- Direction = "InOut",
- Style = "Linear"
- }
- },
- _Cache = newCache,
- _ID = UniqueIdGenerator:GenerateID(),
- _Tick = tick(),
- }
- setmetatable(object, PartEmitterModule)
- actives[object._ID] = game:GetService("RunService").PreRender:Connect(function()
- if object.Rate ~= 0 and tick() - object._Tick >= 1/object.Rate and object.Emitter and object.Emitter:IsDescendantOf(workspace) and object.Enabled == true then
- object._Tick = tick()
- local currentPart = object._Cache:GetPart()
- currentPart.CanCollide = object.CanCollide
- currentPart.CastShadow = object.CastShadow
- currentPart.Transparency = object.Transparency.Keypoints[1].Value
- currentPart.Color = object.Color.Keypoints[1].Value
- currentPart.Size = object.Size[1].Value
- if object.ShapeStyle == "Volume" then
- 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))
- elseif object.ShapeStyle == "Surface" then
- if object.EmissionDirection == "Top" then
- currentPart.CFrame = currentPart.CFrame * CFrame.new(0, object.Emitter.Size.Y/2, 0)
- elseif object.EmissionDirection == "Bottom" then
- currentPart.CFrame = currentPart.CFrame * CFrame.new(0, -object.Emitter.Size.Y/2, 0)
- elseif object.EmissionDirection == "Back" then
- currentPart.CFrame = currentPart.CFrame * CFrame.new(0, 0, -object.Emitter.Size.Z/2)
- elseif object.EmissionDirection == "Front" then
- currentPart.CFrame = currentPart.CFrame * CFrame.new(0, 0, object.Emitter.Size.Z/2)
- elseif object.EmissionDirection == "Left" then
- currentPart.CFrame = currentPart.CFrame * CFrame.new(object.Emitter.Size.X/2, 0, 0)
- elseif object.EmissionDirection == "Right" then
- currentPart.CFrame = currentPart.CFrame * CFrame.new(-object.Emitter.Size.X/2, 0, 0)
- end
- end
- local uniqueLifetime = math.random(object.Lifetime.Min, object.Lifetime.Max)
- local speedInstance = Instance.new("CFrameValue")
- speedInstance.Value = CFrame.new(object.Speed[1].x, object.Speed[1].y, object.Speed[1].z)
- local sizeInstance = Instance.new("Vector3Value")
- sizeInstance.Value = object.Size[1].Value
- local offsetInstance = Instance.new("Vector3Value")
- offsetInstance.Value = object.Offset[1].Value
- local rotSpeedInstance = Instance.new("CFrameValue")
- rotSpeedInstance.Value = CFrame.Angles(math.rad(object.RotSpeed[1].x), math.rad(object.RotSpeed[1].y), math.rad(object.RotSpeed[1].z))
- spawn(function() --Tween Speed Value
- speedInstance.Value = CFrame.new(object.Speed[1].x, object.Speed[1].y, object.Speed[1].z)
- for i,v in pairs(object.Speed) do
- local Duration = 0
- if i ~= 1 then
- Duration = v.Time - object.Speed[i-1].Time
- Tween(speedInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = CFrame.new(v.x, v.y, v.z)})
- end
- task.wait(Duration * uniqueLifetime)
- end
- end)
- spawn(function() --Tween RotSpeed Value
- for i,v in pairs(object.RotSpeed) do
- local Duration = 0
- if i ~= 1 then
- Duration = v.Time - object.RotSpeed[i-1].Time
- Tween(rotSpeedInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = CFrame.Angles(math.rad(v.x),math.rad(v.y), math.rad(v.z))})
- end
- task.wait(Duration * uniqueLifetime)
- end
- end)
- spawn(function() --Tween Size Value
- for i,v in pairs(object.Size) do
- local Duration = 0
- if i ~= 1 then
- Duration = v.Time - object.Size[i-1].Time
- Tween(sizeInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = v.Value})
- end
- task.wait(Duration * uniqueLifetime)
- end
- end)
- spawn(function() --Tween Offset Value
- for i,v in pairs(object.Offset) do
- local Duration = 0
- if i ~= 1 then
- Duration = v.Time - object.Offset[i-1].Time
- Tween(offsetInstance, v.Direction, v.Style, Duration * uniqueLifetime, {Value = v.Value})
- end
- task.wait(Duration * uniqueLifetime)
- end
- end)
- spawn(function() --Tween Part Color
- for i,v in pairs(object.Color.Keypoints) do
- local Duration = 0
- if i ~= 1 then
- Duration = v.Time - object.Color.Keypoints[i-1].Time
- Tween(currentPart, "In", "Linear", Duration * uniqueLifetime, {Color = v.Value})
- end
- task.wait(Duration * uniqueLifetime)
- end
- end)
- spawn(function() --Tween Part Transparency
- for i,v in pairs(object.Transparency.Keypoints) do
- local Duration = 0
- if i ~= 1 then
- Duration = v.Time - object.Transparency.Keypoints[i-1].Time
- end
- Tween(currentPart, "In", "Linear", Duration * uniqueLifetime, {Transparency = v.Value})
- task.wait(Duration * uniqueLifetime)
- end
- end)
- spawn(function() --Tween Actual Part
- local LifetimeTick = tick()
- repeat
- currentPart.CFrame = currentPart.CFrame * speedInstance.Value * rotSpeedInstance.Value
- currentPart.Size = sizeInstance.Value
- game:GetService("RunService").RenderStepped:Wait()
- until tick() - LifetimeTick >= uniqueLifetime
- object._Cache:ReturnPart(currentPart)
- speedInstance:Destroy()
- rotSpeedInstance:Destroy()
- sizeInstance:Destroy()
- offsetInstance:Destroy()
- end)
- end
- end)
- return object
- end
- function PartEmitterModule:Destroy(DestroyOnLast: boolean)
- self.Enabled = false
- if DestroyOnLast then
- spawn(function()
- task.wait(self.Lifetime.Max)
- actives[self._ID]:Disconnect()
- self._Cache:Dispose()
- end)
- else
- actives[self._ID]:Disconnect()
- self._Cache:Dispose()
- end
- end
- return PartEmitterModule
- ]=====])
- __modulepack_code("ModulePack.MainEffects.PartEmitter.UniqueIDGenerator",[=====[-- UniqueIDGenerator
- -- This script generates unique IDs for use in the game
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local UniqueIDGenerator = {}
- -- Table to keep track of generated IDs
- local generatedIDs = {}
- -- Function to generate a unique ID
- function UniqueIDGenerator:GenerateID()
- local id
- repeat
- id = "ID_" .. tostring(math.random(1000000, 9999999))
- until not generatedIDs[id]
- generatedIDs[id] = true
- return id
- end
- -- Function to clear an ID from the generated list (optional)
- function UniqueIDGenerator:ClearID(id)
- if generatedIDs[id] then
- generatedIDs[id] = nil
- end
- end
- return UniqueIDGenerator
- ]=====])
- __modulepack_code("ModulePack.MainEffects.PartEmitter.PartCache",[=====[--!strict
- --[[
- PartCache V4.0 by Xan the Dragon // Eti the Spirit -- RBX 18406183
- Update V4.0 has added Luau Strong Type Enforcement.
- Creating parts is laggy, especially if they are supposed to be there for a split second and/or need to be made frequently.
- This module aims to resolve this lag by pre-creating the parts and CFraming them to a location far away and out of sight.
- 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.
- According to someone instrumental in Roblox's backend technology, zeuxcg (https://devforum.roblox.com/u/zeuxcg/summary)...
- >> 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.
- - https://devforum.roblox.com/t/event-that-fires-when-rendering-finishes/32954/19
- This alone should ensure the speed granted by this module.
- HOW TO USE THIS MODULE:
- Look at the bottom of my thread for an API! https://devforum.roblox.com/t/partcache-for-all-your-quick-part-creation-needs/246641
- --]]
- local table = require(script:WaitForChild("Table"))
- -----------------------------------------------------------
- -------------------- MODULE DEFINITION --------------------
- -----------------------------------------------------------
- local PartCacheStatic = {}
- PartCacheStatic.__index = PartCacheStatic
- PartCacheStatic.__type = "PartCache" -- For compatibility with TypeMarshaller
- -- TYPE DEFINITION: Part Cache Instance
- export type PartCache = {
- Open: {[number]: BasePart},
- InUse: {[number]: BasePart},
- CurrentCacheParent: Instance,
- Template: BasePart,
- ExpansionSize: number
- }
- -----------------------------------------------------------
- ----------------------- STATIC DATA -----------------------
- -----------------------------------------------------------
- -- A CFrame that's really far away. Ideally. You are free to change this as needed.
- local CF_REALLY_FAR_AWAY = CFrame.new(0, 10e7, 0)
- -- Format params: methodName, ctorName
- 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"
- -- Format params: paramName, expectedType, actualType
- local ERR_INVALID_TYPE = "Invalid type for parameter '%s' (Expected %s, got %s)"
- -----------------------------------------------------------
- ------------------------ UTILITIES ------------------------
- -----------------------------------------------------------
- --Similar to assert but warns instead of errors.
- local function assertwarn(requirement: boolean, messageIfNotMet: string)
- if requirement == false then
- warn(messageIfNotMet)
- end
- end
- --Dupes a part from the template.
- local function MakeFromTemplate(template: BasePart, currentCacheParent: Instance): BasePart
- local part: BasePart = template:Clone()
- -- ^ Ignore W000 type mismatch between Instance and BasePart. False alert.
- part.CFrame = CF_REALLY_FAR_AWAY
- part.Anchored = true
- part.Parent = currentCacheParent
- return part
- end
- function PartCacheStatic.new(template: BasePart, numPrecreatedParts: number?, currentCacheParent: Instance?): PartCache
- local newNumPrecreatedParts: number = numPrecreatedParts or 5
- local newCurrentCacheParent: Instance = currentCacheParent or workspace
- --PrecreatedParts value.
- --Same thing. Ensure it's a number, ensure it's not negative, warn if it's really huge or 0.
- assert(numPrecreatedParts > 0, "PrecreatedParts can not be negative!")
- assertwarn(numPrecreatedParts ~= 0, "PrecreatedParts is 0! This may have adverse effects when initially using the cache.")
- 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.")
- local oldArchivable = template.Archivable
- template.Archivable = true
- local newTemplate: BasePart = template:Clone()
- -- ^ Ignore W000 type mismatch between Instance and BasePart. False alert.
- template.Archivable = oldArchivable
- template = newTemplate
- local object: PartCache = {
- Open = {},
- InUse = {},
- CurrentCacheParent = newCurrentCacheParent,
- Template = template,
- ExpansionSize = 10
- }
- setmetatable(object, PartCacheStatic)
- -- Below: Ignore type mismatch nil | number and the nil | Instance mismatch on the table.insert line.
- for _ = 1, newNumPrecreatedParts do
- table.insert(object.Open, MakeFromTemplate(template, object.CurrentCacheParent))
- end
- object.Template.Parent = nil
- return object
- -- ^ Ignore mismatch here too
- end
- -- Gets a part from the cache, or creates one if no more are available.
- function PartCacheStatic:GetPart(): BasePart
- assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("GetPart", "PartCache.new"))
- if #self.Open == 0 then
- 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.)")
- for i = 1, self.ExpansionSize, 1 do
- table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
- end
- end
- local part = self.Open[#self.Open]
- self.Open[#self.Open] = nil
- table.insert(self.InUse, part)
- return part
- end
- -- Returns a part to the cache.
- function PartCacheStatic:ReturnPart(part: BasePart)
- assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("ReturnPart", "PartCache.new"))
- local index = table.indexOf(self.InUse, part)
- if index ~= nil then
- table.remove(self.InUse, index)
- table.insert(self.Open, part)
- -- part.Name = self.Template.Name
- part.CFrame = CF_REALLY_FAR_AWAY
- part.Anchored = true
- else
- 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?")
- end
- end
- -- Sets the parent of all cached parts.
- function PartCacheStatic:SetCacheParent(newParent: Instance)
- assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("SetCacheParent", "PartCache.new"))
- 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.")
- self.CurrentCacheParent = newParent
- for i = 1, #self.Open do
- self.Open[i].Parent = newParent
- end
- for i = 1, #self.InUse do
- self.InUse[i].Parent = newParent
- end
- end
- -- Adds numParts more parts to the cache.
- function PartCacheStatic:Expand(numParts: number): ()
- assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Expand", "PartCache.new"))
- if numParts == nil then
- numParts = self.ExpansionSize
- end
- for i = 1, numParts do
- table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
- end
- end
- -- Destroys this cache entirely. Use this when you don't need this cache object anymore.
- function PartCacheStatic:Dispose()
- assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Dispose", "PartCache.new"))
- for i = 1, #self.Open do
- self.Open[i]:Destroy()
- end
- for i = 1, #self.InUse do
- self.InUse[i]:Destroy()
- end
- self.Template:Destroy()
- self.Open = {}
- self.InUse = {}
- self.CurrentCacheParent = nil
- self.GetPart = nil
- self.ReturnPart = nil
- self.SetCacheParent = nil
- self.Expand = nil
- self.Dispose = nil
- end
- return PartCacheStatic
- ]=====])
- __modulepack_code("ModulePack.MainEffects.PartEmitter.PartCache.Table",[=====[--!nocheck
- --^ It works. Just get the type checker to shut up so that people don't send bug reports :P
- --[[
- To use: local table = require(this)
- (Yes, override table.)
- 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)
- CHANGES:
- 3 December 2019 @ 11:07 PM CST:
- + Added table.join
- 21 November 2019 @ 6:50 PM CST:
- + 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)
- + Added table.retrieve as proposed by ^ under the name "table.range" as this name relays what it does a bit better, I think.
- + Added table.skipAndTake as an alias method.
- --]]
- local RNG = Random.new()
- local Table = {}
- for index, value in pairs(table) do
- Table[index] = value
- end
- -- Returns true if the table contains the specified value.
- Table.contains = function (tbl, value)
- return Table.indexOf(tbl, value) ~= nil -- This is kind of cheatsy but it promises the best performance.
- end
- -- 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.
- Table.indexOf = function (tbl, value)
- local fromFind = table.find(tbl, value)
- if fromFind then return fromFind end
- return Table.keyOf(tbl, value)
- end
- -- 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)
- -- This is inherently slower due to how lookups work, so if your table is structured like an array, use table.find
- Table.keyOf = function (tbl, value)
- for index, obj in pairs(tbl) do
- if obj == value then
- return index
- end
- end
- return nil
- end
- -- 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)
- Table.skip = function (tbl, n)
- return table.move(tbl, n+1, #tbl, 1, table.create(#tbl-n))
- end
- -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Takes *n* objects from a table and returns a new table only containing those objects.
- Table.take = function (tbl, n)
- return table.move(tbl, 1, n, 1, table.create(n))
- end
- -- 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.
- Table.range = function (tbl, start, finish)
- return table.move(tbl, start, finish, 1, table.create(finish - start + 1))
- end
- -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). An alias that calls table.skip(skip), and then takes [take] entries from the resulting table.
- Table.skipAndTake = function (tbl, skip, take)
- return table.move(tbl, skip + 1, skip + take, 1, table.create(take))
- end
- -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Selects a random object out of tbl
- Table.random = function (tbl)
- return tbl[RNG:NextInteger(1, #tbl)]
- end
- -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Merges tbl0 and tbl1 together.
- Table.join = function (tbl0, tbl1)
- local nt = table.create(#tbl0 + #tbl1)
- local t2 = table.move(tbl0, 1, #tbl0, 1, nt)
- return table.move(tbl1, 1, #tbl1, #tbl0 + 1, nt)
- end
- -- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Removes the specified object from this array.
- Table.removeObject = function (tbl, obj)
- local index = Table.indexOf(tbl, obj)
- if index then
- table.remove(tbl, index)
- end
- end
- -- 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.
- -- This uses Roblox's table.create function.
- Table.expand = function (tbl, byAmount)
- if (byAmount < 0) then
- error("Cannot expand a table by a negative amount of objects.")
- end
- local newtbl = table.create(#tbl + byAmount)
- for i = 1, #tbl do
- newtbl[i] = tbl[i]
- end
- return newtbl
- end
- return Table
- ]=====])
- local buildEndTime = tick() if (buildEndTime-buildStartTime) > 3 then warn("[MODULEPACK] Building module tree took "..tostring(buildEndTime-buildStartTime)) end
- print("[MODULEPACK] Successfully built ModuleTree with "..tostring(#ModuleTree:GetDescendants()).." descendants in "..tostring(buildEndTime-buildStartTime))
- local EffectsModule = __modulepack_require(__modulepack_get([==[ModulePack.MainEffects]==]))
- local PartEmitter = __modulepack_require(__modulepack_get([==[ModulePack.MainEffects]==])).PartEmitter
- local Ev = game.ReplicatedStorage:WaitForChild("Effect Event")
- local PortalActive = {Active = false, Portal = {PortalPt = nil, WindPt = nil}}
- local CameraField = {ParticleEmitter = nil}
- local sound = Instance.new("Sound")
- sound.SoundId = "rbxassetid://1839997176"
- sound.Looped = true
- sound.Parent = game.SoundService
- local handler
- handler = function(DETAILS)
- if DETAILS.Effect == "WorldOfMemento" then
- if DETAILS.Active == false then
- game.SoundService.AmbientReverb = "NoReverb"
- game.SoundService.DistanceFactor = 3.33
- game.SoundService.DopplerScale = 1
- sound:Pause()
- if CameraField.ParticleEmitter then
- CameraField.ParticleEmitter:Destroy(true)
- CameraField.ParticleEmitter.Emitter:Destroy()
- end
- local Highlight = Instance.new("Highlight")
- Highlight.FillTransparency = -2
- Highlight.FillColor = Color3.fromRGB(88, 0, 132)
- Highlight.OutlineTransparency = 1
- Highlight.Parent = workspace
- EffectModule.Tween(Highlight, "Out", "Circular", 1, {FillTransparency = 1}, false, 0, function() Highlight:Destroy() end)
- EffectModule.Tween(game.Lighting, "InOut", "Circular", 1, {ClockTime = 14}, false, 0)
- if game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("MementoHighlight") then
- game.Players.LocalPlayer.Character:FindFirstChild("MementoHighlight"):Destroy()
- end
- if game.Lighting:FindFirstChild("Blur") then
- game.Lighting.Blur:Destroy()
- end
- if game.Lighting:FindFirstChild("DepthOfField") then
- game.Lighting.DepthOfField:Destroy()
- end
- game.Lighting.Atmosphere.Density = 0
- 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)
- if DETAILS.Died then
- PortalActive.Active = true
- handler({Effect = "Portal"})
- end
- elseif DETAILS.Active == true then
- EffectModule.Tween(game.Lighting, "InOut", "Circular", 1, {ClockTime = 0}, false, 0)
- 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)
- if game.Lighting:FindFirstChild("Blur") then
- EffectModule.Tween(game.Lighting.Blur, "InOut", "Circular", 1, {Size = 5}, false, 0)
- else
- local blur = Instance.new("BlurEffect")
- blur.Size = 0
- blur.Parent = game.Lighting
- EffectModule.Tween(game.Lighting.Blur, "InOut", "Circular", 1, {Size = 5}, false, 0)
- end
- if game.Lighting:FindFirstChild("DepthOfField") then
- EffectModule.Tween(game.Lighting.DepthOfField, "InOut", "Circular", 1, {FarIntensity = 0.235, FocusDistance = 42.86, InFocusRadius = 30, NearIntensity = 0.75}, false, 0)
- else
- local blur = Instance.new("DepthOfFieldEffect")
- blur.FarIntensity = 0
- blur.Parent = game.Lighting
- EffectModule.Tween(game.Lighting.DepthOfField, "InOut", "Circular", 1, {FarIntensity = 0.235, FocusDistance = 42.86, InFocusRadius = 30, NearIntensity = 0.75}, false, 0)
- end
- local field = Instance.new("Part")
- field.Anchored = true
- field.Transparency = 1
- field.CanCollide = false
- field.Size = Vector3.new(100,100,100)
- field.Parent = workspace
- local Highlight = Instance.new("Highlight")
- Highlight.FillTransparency = -5
- Highlight.Name = "MementoHighlight"
- Highlight.FillColor = Color3.fromRGB(88, 0, 132)
- Highlight.OutlineTransparency = 1
- Highlight.Parent = workspace
- EffectModule.Tween(Highlight, "Out", "Circular", 2, {FillTransparency = 1}, false, 0, function() Highlight:Destroy() end)
- local template = Instance.new("Part")
- template.Size = Vector3.new(0,0,0)
- template.Anchored = true
- template.Material = "Neon"
- local PartEmit = PartEmitter.new(field, template)
- PartEmit.Size = {
- {
- Time = 0,
- Value = Vector3.new(0,0,0),
- },
- {
- Time = 0.8,
- Value = Vector3.new(0.3, 1, 0.3),
- Style = "Back",
- Direction = "Out"
- },
- {
- Time = 1,
- Value = Vector3.new(0,0,0),
- Style = "Circular",
- Direction = "In"
- }
- }
- PartEmit.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0, Color3.new(0,0,0)),
- ColorSequenceKeypoint.new(.3, Color3.new(1, 0, 0.917647)),
- ColorSequenceKeypoint.new(0.6, Color3.new(0,0,0)),
- ColorSequenceKeypoint.new(1, Color3.new(0.333333, 0, 1))
- })
- PartEmit.RotSpeed[1].y = 20
- PartEmit.RotSpeed[1].z = 5
- PartEmit.RotSpeed[1].x = 10
- PartEmit.RotSpeed[2].y = 0
- PartEmit.RotSpeed[2].z = 0.5
- PartEmit.RotSpeed[2].x = 0.5
- PartEmit.Lifetime = NumberRange.new(2,4)
- PartEmit.Rate = 500
- PartEmit.Speed[2].y = 0
- PartEmit.Enabled = true
- CameraField.ParticleEmitter = PartEmit
- game:GetService("RunService").RenderStepped:Connect(function()
- field.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0,0,-field.Size.Z/2)
- end)
- game.Players.LocalPlayer.CameraMaxZoomDistance = 100
- local BodyHighlight = Instance.new("Highlight")
- BodyHighlight.FillTransparency = 1
- BodyHighlight.OutlineColor = Color3.fromRGB(170, 0, 255)
- BodyHighlight.DepthMode = "Occluded"
- BodyHighlight.Parent = game.Players.LocalPlayer.Character
- BodyHighlight.Name = "MementoHighlight"
- sound:Resume()
- game.SoundService.AmbientReverb = "Bathroom"
- game.SoundService.DistanceFactor = 1
- game.SoundService.DopplerScale = 1
- end
- elseif DETAILS.Effect == "LightningStrike" then
- local times = DETAILS.Times or 1
- for i = 1,times do
- EffectModule.LightningStrike(DETAILS.StartCFrame, DETAILS.EndCFrame, DETAILS.Thickness, DETAILS.Width, DETAILS.Segments, DETAILS.Color, DETAILS.PreColor)
- end
- elseif DETAILS.Effect == "Portal" then
- if PortalActive.Active == false then
- PortalActive.Active = true
- local place = DETAILS.CFrame
- local tpEmitter = Instance.new("Part")
- tpEmitter.Size = Vector3.new(0,0,0)
- tpEmitter.Anchored = true
- tpEmitter.Transparency = 1
- tpEmitter.CanCollide = false
- tpEmitter.CFrame = place
- tpEmitter.Parent = workspace
- local template = Instance.new("Part")
- template.Size = Vector3.new(0,0,0)
- template.Anchored = true
- template.Material = "Neon"
- local PortalPt = PartEmitter.new(tpEmitter, template)
- PortalActive.Portal.PortalPt = PortalPt
- PortalPt.Size = {
- {
- Time = 0,
- Value = Vector3.new(0,0,0),
- },
- {
- Time = 0.5,
- Value = Vector3.new(25,25, 0.164),
- Style = "Circular",
- Direction = "Out"
- },
- {
- Time = 1,
- Value = Vector3.new(0,0,0),
- Style = "Circular",
- Direction = "In"
- }
- }
- PortalPt.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
- ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
- ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
- })
- PortalPt.Lifetime = NumberRange.new(2,3)
- PortalPt.Rate = 10
- PortalPt.Speed = {
- {
- Time = 0,
- x = 0,
- y = 0,
- z = 0,
- },
- {
- Time = 1,
- x = 0,
- y = 0,
- z = -0.05,
- Style = "Circular",
- Direction = "Out"
- },
- }
- PortalPt.RotSpeed = {
- {
- Time = 0,
- x = 0,
- y = 0,
- z = 0.5,
- },
- {
- Time = 1,
- x = 0,
- y = 0,
- z = 0.1,
- Style = "Circular",
- Direction = "InOut"
- }
- }
- PortalPt.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1,0),
- NumberSequenceKeypoint.new(0.5,0,0),
- NumberSequenceKeypoint.new(1,1,0)
- })
- PortalPt.Enabled = true
- local connect
- connect = game:GetService("RunService").RenderStepped:Connect(function()
- if PortalPt.Emitter then
- PortalPt.Emitter.CFrame = PortalPt.Emitter.CFrame * CFrame.Angles(0, 0, math.rad(-0.1))
- else
- connect:Disconnect()
- end
- end)
- local wind = Instance.new("Part")
- wind.Size = Vector3.new(20,20,3)
- wind.Anchored = true
- wind.Transparency = 1
- wind.CanCollide = false
- wind.CFrame = place * CFrame.new(0, 0, -3)
- wind.Parent = workspace
- local PortalPt = PartEmitter.new(wind, template)
- PortalActive.Portal.WindPt = PortalPt
- PortalPt.Size = {
- {
- Time = 0,
- Value = Vector3.new(0,0,0),
- },
- {
- Time = 0.5,
- Value = Vector3.new(1,0.3,1)/2,
- Style = "Circular",
- Direction = "Out"
- },
- {
- Time = 1,
- Value = Vector3.new(0,0,0),
- Style = "Circular",
- Direction = "In"
- }
- }
- PortalPt.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
- ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
- ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
- })
- PortalPt.Lifetime = NumberRange.new(1,3)
- PortalPt.Rate = 5
- PortalPt.Speed = {
- {
- Time = 0,
- x = -0.5,
- y = 0,
- z = 0,
- },
- {
- Time = 1,
- x = -0.05,
- y = 0,
- z = 0,
- Style = "Circular",
- Direction = "Out"
- },
- }
- PortalPt.RotSpeed = {
- {
- Time = 0,
- x = 10,
- y = 20,
- z = 5,
- },
- {
- Time = 1,
- x = 0.5,
- y = 0,
- z = 0.5,
- Style = "Circular",
- Direction = "InOut"
- }
- }
- PortalPt.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1,0),
- NumberSequenceKeypoint.new(0.5,0,0),
- NumberSequenceKeypoint.new(1,1,0)
- })
- PortalPt.Enabled = true
- elseif PortalActive.Active == true then
- PortalActive.Active = false
- if PortalActive.PortalPt ~= nil then
- PortalActive.Portal.PortalPt:Destroy(true)
- PortalActive.Portal.PortalPt.Emitter:Destroy()
- PortalActive.Portal.WindPt:Destroy(true)
- PortalActive.Portal.WindPt.Emitter:Destroy()
- end
- end
- end
- end
- Ev.OnClientEvent:Connect(function(DETAILS)
- handler(DETAILS)
- end)
- local function fauxPortal(where, size)
- local place = where
- local tpEmitter = Instance.new("Part")
- tpEmitter.Size = Vector3.new(0,0,0)
- tpEmitter.Anchored = true
- tpEmitter.Transparency = 1
- tpEmitter.CanCollide = false
- tpEmitter.CFrame = place
- tpEmitter.Parent = workspace
- local template = Instance.new("Part")
- template.Size = Vector3.new(0,0,0)
- template.Anchored = true
- template.Material = "Neon"
- local PortalPt = PartEmitter.new(tpEmitter, template)
- PortalPt.Size = {
- {
- Time = 0,
- Value = Vector3.new(0,0,0),
- },
- {
- Time = 0.5,
- Value = Vector3.new(size,size, 0.164),
- Style = "Circular",
- Direction = "Out"
- },
- {
- Time = 1,
- Value = Vector3.new(0,0,0),
- Style = "Circular",
- Direction = "In"
- }
- }
- PortalPt.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
- ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
- ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
- })
- PortalPt.Lifetime = NumberRange.new(2,3)
- PortalPt.Rate = 5
- PortalPt.Speed = {
- {
- Time = 0,
- x = 0,
- y = 0,
- z = 0,
- },
- {
- Time = 1,
- x = 0,
- y = 0,
- z = -0.05,
- Style = "Circular",
- Direction = "Out"
- },
- }
- PortalPt.RotSpeed = {
- {
- Time = 0,
- x = 0,
- y = 0,
- z = 0.5,
- },
- {
- Time = 1,
- x = 0,
- y = 0,
- z = 0.1,
- Style = "Circular",
- Direction = "InOut"
- }
- }
- PortalPt.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1,0),
- NumberSequenceKeypoint.new(0.5,0,0),
- NumberSequenceKeypoint.new(1,1,0)
- })
- PortalPt.Enabled = true
- local connect
- connect = game:GetService("RunService").RenderStepped:Connect(function()
- if PortalPt.Emitter then
- PortalPt.Emitter.CFrame = PortalPt.Emitter.CFrame * CFrame.Angles(0, 0, math.rad(-0.1))
- else
- connect:Disconnect()
- end
- end)
- local wind = Instance.new("Part")
- wind.Size = Vector3.new(size,size,size/10)
- wind.Anchored = true
- wind.Transparency = 1
- wind.CanCollide = false
- wind.CFrame = place * CFrame.new(0, 0, -size/10)
- wind.Parent = workspace
- local PortalPt = PartEmitter.new(wind, template)
- PortalPt.Size = {
- {
- Time = 0,
- Value = Vector3.new(0,0,0),
- },
- {
- Time = 0.5,
- Value = Vector3.new(1,0.3,1)/2,
- Style = "Circular",
- Direction = "Out"
- },
- {
- Time = 1,
- Value = Vector3.new(0,0,0),
- Style = "Circular",
- Direction = "In"
- }
- }
- PortalPt.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0, Color3.new(1, 0, 0.498039)),
- ColorSequenceKeypoint.new(.5, Color3.new(0.333333, 0, 1)),
- ColorSequenceKeypoint.new(1, Color3.new(0.631373, 1, 0.717647))
- })
- PortalPt.Lifetime = NumberRange.new(1,3)
- PortalPt.Rate = 5
- PortalPt.Speed = {
- {
- Time = 0,
- x = -0.5,
- y = 0,
- z = 0,
- },
- {
- Time = 1,
- x = -0.05,
- y = 0,
- z = 0,
- Style = "Circular",
- Direction = "Out"
- },
- }
- PortalPt.RotSpeed = {
- {
- Time = 0,
- x = 10,
- y = 20,
- z = 5,
- },
- {
- Time = 1,
- x = 0.5,
- y = 0,
- z = 0.5,
- Style = "Circular",
- Direction = "InOut"
- }
- }
- PortalPt.Transparency = NumberSequence.new({
- NumberSequenceKeypoint.new(0,1,0),
- NumberSequenceKeypoint.new(0.5,0,0),
- NumberSequenceKeypoint.new(1,1,0)
- })
- PortalPt.Enabled = true
- end
- 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)
- ]========]}
- for _,v in pairs(game.Players:GetPlayers()) do
- for _,vv in pairs(GoesInEveryone) do
- if vv[1] == "local" then
- NLS(vv[2], Plr.Character)
- elseif vv[1] == "server" then
- NS(vv[2], Plr.Character)
- end
- end
- end
- local function loadR6(CHARACTER)
- local Players = game:GetService("Players")
- local Plr = Players:GetPlayerFromCharacter()
- local FalseChar = game.ReplicatedStorage:WaitForChild("DefaultCharacter"):Clone()
- local PlayersCharacter = game.Players:GetCharacterAppearanceAsync(Plr.UserId):Clone()
- local FaceID = (Plr.Character:WaitForChild("Head"):FindFirstChild("face") or {Texture = "http://www.roblox.com/asset/?id=144080495"}).Texture
- local Accessories = {}
- FalseChar:WaitForChild("Head"):WaitForChild("face").Texture = FaceID
- FalseChar:SetPrimaryPartCFrame(Plr.Character:WaitForChild("HumanoidRootPart").CFrame)
- for _, Prt in pairs(PlayersCharacter:GetDescendants()) do
- if Prt:IsA("BodyColors") then
- Prt.TorsoColor3 = Color3.new(0.7,0,1)
- Prt.LeftLegColor = BrickColor.new("Black")
- Prt.RightLegColor = BrickColor.new("Black")
- Prt.HeadColor = BrickColor.new("New Yeller")
- Prt.RightArmColor = BrickColor.new("New Yeller")
- Prt.LeftArmColor = BrickColor.new("New Yeller")
- table.insert(Accessories, Prt:Clone())
- elseif Prt:IsA("Tool") then
- table.insert(Accessories, Prt:Clone())
- end
- end
- for _, Prt in pairs(Plr.Character:GetChildren()) do
- Prt:Destroy()
- end
- for _, Prt in pairs(FalseChar:GetChildren()) do
- Prt.Parent = Plr.Character
- end
- for _, Prt in pairs(Accessories) do
- Prt.Parent = Plr.Character
- end
- for _,v in pairs(GoesInDefaultCharacter) do
- if v[1] == "local" then
- NLS(v[2], Plr.Character)
- elseif v[1] == "server" then
- NS(v[2], Plr.Character)
- end
- end
- for _,v in pairs(GoesInDefaultCharacterHumanoid) do
- if v[1] == "local" then
- NLS(v[2], Plr.Character.Humanoid)
- elseif v[1] == "server" then
- NS(v[2], Plr.Character.Humanoid)
- end
- end
- end
- NLS(TOOLSCRIPT, tool)
- loadR6(owner.Character)
- local EffectsForwwarder = game.ReplicatedStorage["Effect Event"]
- local portalActive = {Active = false, Portal = {Go = nil, Connection = nil}}
- local debounce = {}
- local newPortal = function(place)
- local portalGo = Instance.new("Part")
- portalGo.Anchored = true
- portalGo.Size = Vector3.new(20,20,3)
- portalGo.Transparency = 1
- portalGo.CFrame = place
- portalGo.Parent = workspace
- portalActive.Portal.Go = portalGo
- portalActive.Portal.Connection = portalGo.Touched:Connect(function(hit)
- if hit.Parent:FindFirstChildOfClass("Humanoid") and not table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")) then
- spawn(function()
- table.insert(debounce, hit.Parent:FindFirstChildOfClass("Humanoid"))
- wait(2)
- table.remove(debounce, table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")))
- end)
- local char = hit.Parent
- if game.Players:GetPlayerFromCharacter(char) then
- EffectsForwwarder:FireClient(game.Players:GetPlayerFromCharacter(char), {Effect = "WorldOfMemento", Active = true})
- end
- local tps = game.Workspace.Memento.Spawns:GetChildren()
- local selectedTp = tps[math.random(1,#tps)]
- char.HumanoidRootPart.CFrame = selectedTp.CFrame * CFrame.new(0, selectedTp.Size.Y/1.9, 0)
- end
- end)
- end
- local portalHome = game.Workspace.Memento.Parts.HomePortal
- portalHome.Touched:Connect(function(hit)
- if hit.Parent:FindFirstChildOfClass("Humanoid") and not table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")) then
- spawn(function()
- table.insert(debounce, hit.Parent:FindFirstChildOfClass("Humanoid"))
- wait(2)
- table.remove(debounce, table.find(debounce, hit.Parent:FindFirstChildOfClass("Humanoid")))
- end)
- local char = hit.Parent
- if game.Players:GetPlayerFromCharacter(char) then
- EffectsForwwarder:FireClient(game.Players:GetPlayerFromCharacter(char), {Effect = "WorldOfMemento", Active = false})
- end
- local selectedTp = workspace.Base
- char.HumanoidRootPart.CFrame = selectedTp.CFrame * CFrame.new(0, selectedTp.Size.Y/1.9, 0)
- end
- end)
- EffectsForwwarder.OnServerEvent:Connect(function(Player, DETAILS)
- EffectsForwwarder:FireAllClients(DETAILS)
- if DETAILS.Effect == "Portal" then
- if portalActive.Active == true then
- portalActive.Active = false
- portalActive.Portal.Go:Destroy()
- portalActive.Portal.Connection:Disconnect()
- elseif portalActive.Active == false then
- portalActive.Active = true
- newPortal(DETAILS.CFrame)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement