Effects

 avatar
unknown
lua
2 years ago
10 kB
7
Indexable
local module = {}
local Debris = game:GetService("Debris")
local remotes = game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage"):WaitForChild("Remotes")
local TweeningService = game:GetService("TweenService")
local runservice = game:GetService("RunService")
local Storage = game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage")
local camera = game.Workspace.CurrentCamera



local camShake =  require(Storage.Modules.CameraShaker).new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
	camera.CFrame *= shakeCFrame
end)

camShake:Start()

module.DisableControls = function()
	print('disabled')
	local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
	controls:Disable()
	task.delay(10,function()
		controls:Enable()
	end)

end

module.Flesh = function(player,titan,op)
	local Limbs = {}
	local t = op[2]
	local retreat = op[1]
	for _,Part in ipairs(titan:GetDescendants()) do 
		if Part:IsA("BasePart") then
			local Goal = {}
			Goal.Color = Color3.new(0.380392, 0.00392157, 0.00392157)
			table.insert(Limbs,{Part,Part.Color})
			Part.Color = Goal.Color
			print('yus')
			
		end
	end
	if not retreat then return end
	local Info  = TweenInfo.new(t,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
	for _,Part in ipairs(Limbs) do 			
		local Goal = {}
		Goal.Color = Part[2]
		TweeningService:Create(Part[1],Info,Goal):Play()

	end

end

function Emitter(InstanceObj,Decay)
	local Particles = {}
	local EmitEvent
	for _,Particle in ipairs(InstanceObj:GetDescendants()) do 
		if Particle:IsA("ParticleEmitter") then
			table.insert(Particles,Particle)
		end
	end
	EmitEvent = runservice.RenderStepped:Connect(function()
		for _,Particle in ipairs(Particles) do
			Particle:Emit(Particle:GetAttribute("EmitCount"))
		end
	end)
	task.delay(Decay,function()
		EmitEvent:Disconnect()
	end)

end

module.EnableControls = function()
	print('disabled')
	local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
	controls:Enable()


end
module.AddToCollisionGroup = function(p,model)

	game:GetService("RunService").Heartbeat:Connect(function()
		for _,Part in ipairs(model:GetDescendants()) do 
			if Part:IsA("BasePart") and Part.Name ~= "HumanoidRootPart" then
				Part.AssemblyLinearVelocity = Vector3.new(0,0,0)
				Part.AssemblyAngularVelocity = Vector3.new(0,0,0)
				Part.Massless = true
				Part.CanCollide = true
			end
		end
	end)
	--[[
	for _,Part in ipairs(model:GetDescendants()) do 
		if Part:IsA("BasePart") then
			PhysicsService:SetPartCollisionGroup(Part,Group)
			print("Added: "..Part.Name.." to collision group")
		end
	end]]
end


module.Nuke = function(player)
	local VFX = Storage:WaitForChild("VFX").Nuke:Clone()
	VFX:PivotTo(player.Character:GetPivot())
	Emitter(VFX,3)
	Debris:AddItem(VFX,4)

	VFX.Parent = game.Workspace
	local light = game:GetService("Lighting")

	local function GetAtmos()
		local NewAtmost = Instance.new("Atmosphere",light)
		local Blur = Instance.new("BlurEffect",light)
		local Bloom = Instance.new("BloomEffect",light)
		Blur.Size = 0
		TweeningService:Create(NewAtmost,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Density = .5;Color = Color3.new(1, 0.333333, 0);Decay = Color3.new(1, 1, 0);Glare = 5;Haze = 5}):Play()
		TweeningService:Create(Blur,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Size = 10}):Play()
		TweeningService:Create(Bloom,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Intensity = 10;Size = 100;Threshold = 1}):Play()
		Debris:AddItem(NewAtmost,11)
		Debris:AddItem(Blur,11)
		Debris:AddItem(Bloom,11)

	end
	GetAtmos()
end

module["SetPos"] = function(player,c,cf)

end
module["ErenFoundingTitan"] = function(player)
	local Frames = Storage:WaitForChild("Animations"):WaitForChild("ErenFoundingTitan"):WaitForChild("Frames")
	local Connection
	local FrameTime = 0
	local list = workspace:FindFirstChild("leave_alone")
	
	camera.CameraType = Enum.CameraType.Scriptable
	
	Connection = runservice.RenderStepped:Connect(function(DT)
		FrameTime += (DT * 60) 

		local NeededFrame =Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
		if NeededFrame then
			camera.CFrame = CFrame.new((player.Character.PrimaryPart.CFrame * NeededFrame.Value).Position,player.Character.Head.CFrame.Position)
		else
			Connection:Disconnect()
			--player.Character.Humanoid.AutoRotate = true
			--camera.CameraType = Enum.CameraType.Custom
			--	camera.CameraType = Enum.CameraType.Custom	
		end
	end)
	repeat task.wait() until not Connection.Connected
	local box = 	 Storage:WaitForChild("VFX").BOX:Clone()
	for _,v in ipairs(game.Workspace:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			local allowed = true
			for i,o in ipairs(list:GetChildren()) do
				if v:IsDescendantOf(o.Value) then
					allowed = false
					break
				end
			end		
			if not allowed then continue end
			local c = v.Transparency
v.Transparency = 1
			task.delay(10,function()
				v.Transparency = c
			end)
		end

	end
	Debris:AddItem(box,10)
	box:PivotTo(player.Character:GetPivot() * CFrame.new(0,0,-100))
	box.Parent = game.Workspace
	
	local Block =  Storage:WaitForChild("VFX").Block:Clone()
	Block.CFrame = player.Character.PrimaryPart.CFrame * CFrame.new(-0.739105225, 0.326922655, -89.2936401, 0, 0, -1, 0, 1, 0, 1, 0, 0)
	Debris:AddItem(Block,10)
	local function GetAtmos()
		local NewAtmost = Instance.new("ColorCorrectionEffect",game.Lighting)
		local Blur = Instance.new("BlurEffect",game.Lighting)
		local Bloom = Instance.new("BloomEffect",game.Lighting)
		Blur.Size = 0
		TweeningService:Create(NewAtmost,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Brightness = 5;TintColor = Color3.new(0, 1, 1)}):Play()
		TweeningService:Create(Blur,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Size = 10}):Play()
		TweeningService:Create(Bloom,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Intensity = 10;Size = 100;Threshold = 1}):Play()
		Debris:AddItem(NewAtmost,11)
		Debris:AddItem(Blur,11)
		Debris:AddItem(Bloom,11)

	end
	GetAtmos()
	
	local VFX = Storage:WaitForChild("VFX").Nuke:Clone()
	VFX:PivotTo(player.Character:GetPivot())
	Emitter(VFX,3)
	Debris:AddItem(VFX,4)

	VFX.Parent = game.Workspace
	local light = game:GetService("Lighting")

	local function GetAtmos()
		local NewAtmost = Instance.new("Atmosphere",light)
		local Blur = Instance.new("BlurEffect",light)
		local Bloom = Instance.new("BloomEffect",light)
		Blur.Size = 0
		TweeningService:Create(NewAtmost,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Density = .5;Color = Color3.new(1, 0.333333, 0);Decay = Color3.new(1, 1, 0);Glare = 5;Haze = 5}):Play()
		TweeningService:Create(Blur,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Size = 10}):Play()
		TweeningService:Create(Bloom,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Intensity = 10;Size = 100;Threshold = 1}):Play()
		Debris:AddItem(NewAtmost,11)
		Debris:AddItem(Blur,11)
		Debris:AddItem(Bloom,11)

	end
	GetAtmos()
	
	Block.Parent = game.Workspace
	camShake:Shake(camShake.Presets.Thunder)
	camShake:Shake(camShake.Presets.Wooble)
	
	task.delay(9,function()
		camera.CameraType = Enum.CameraType.Custom
		camera.CameraSubject = player.Character.PrimaryPart
		
	end)
end
module.Bubble = function(player)
	local VFX = Storage:WaitForChild("VFX").TitanBubble:Clone()
	VFX.Parent = game:GetService("Workspace")
	Debris:AddItem(VFX,4)
	local Sphere1 = VFX.Light
	Sphere1.Anchored = true

	Sphere1.CanCollide = false
	local Sphere2 = Sphere1.Sphere
	Sphere2.CanCollide = false
	VFX.Light.CFrame = player.Character.PrimaryPart.CFrame

	remotes:WaitForChild("Spark"):Fire(player,"Shift_Air")




	local Tween = game:GetService("TweenService")

	Tween:Create(Sphere1,TweenInfo.new(.1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,-1,true),{Size = Sphere1.Size + Vector3.new(10,10,10)}):Play()


	Tween:Create(Sphere2,TweenInfo.new(.2,Enum.EasingStyle.Sine,Enum.EasingDirection.In,-1,true),{Size = Sphere1.Size + Vector3.new(50,50,50);Transparency = .5}):Play()
end

module.Floor_Shift = function(player)
	local VFX = game:GetService("ReplicatedStorage"):WaitForChild("TitanOSReplicatedStorage"):WaitForChild("VFX").GroundVFX:Clone()
	Debris:AddItem(VFX,5)
	VFX.PrimaryPart.CFrame = player.Character.PrimaryPart.CFrame
	VFX.PrimaryPart.Anchored = true
	VFX.PrimaryPart.CanCollide = false
	VFX.Parent = game.Workspace
	Emitter(VFX,4)

end

module.Decay = function(player,titan)
	local Info = TweenInfo.new(10,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
	local Cf,size = titan:GetBoundingBox()
	local Steam = Storage:WaitForChild("Particles").SteamBlock:Clone()
	Debris:AddItem(Steam,19)
	Steam.Anchored = true
	Steam.CanCollide = false
	Steam.CFrame = Cf
	Steam.Size = size
	Steam.Parent = game.Workspace
	local SteamSound = Storage:WaitForChild("Sounds"):FindFirstChild("Steam",true):Clone()
	Debris:AddItem(SteamSound,4)
	SteamSound.Parent = titan
	SteamSound:Play()
	Steam:FindFirstChild("Steam").Size = NumberSequence.new(size.Y/100,size.Y)
	Steam:FindFirstChild("Steam").Lifetime = NumberRange.new(0,size.Y)
	Steam:FindFirstChild("Steam").SpreadAngle = Vector2.new(0,size.Y)
	local MoveTo	
	MoveTo = runservice.RenderStepped:Connect(function(dt)
		Steam.CFrame =  titan.PrimaryPart.CFrame * dt
	end)
	for _,Part in ipairs(titan:GetDescendants()) do 
		if Part:IsA("BasePart") then

			local Goal = {}
			Goal.Color = Color3.new()
			TweeningService:Create(Part,Info,Goal):Play()
			task.delay(9,function()
				Goal.Transparency = 1
				local Gone = TweeningService:Create(Part,Info,Goal)
				Gone:Play()

			end)

		end
	end
	MoveTo:Disconnect()
end
return module
Editor is loading...