-- FUNCTIONS --

return function(Character)
	local random = Random.new(math.random(1, 10))
	local function randomizeColors()
		for i, v in pairs(Character:GetDescendants()) do
			coroutine.wrap(function()
				if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("UnionOperation") then
					if v.Name == "Head" then
						if v:FindFirstChild("Mesh") then
							v["Mesh"]:Destroy()
						end
					end

					v.Material = Enum.Material.Neon
					TS:Create(v, TweenInfo.new(0.15), {Color = Colors[random:NextInteger(1, #Colors)]}):Play()
				end
			end)()
		end
	end

	coroutine.wrap(function()
		while Character do
			randomizeColors()

			task.wait(0.15)
		end
		
		partCache:Dispose()
	end)()

	task.delay(1, function()
		for i, v in pairs(Character:GetDescendants()) do
			if v:IsA("MeshPart") or v:IsA("Part") then
				-- Implode Tween --
				local tweenTime = 0.7
				
				local ImpTween = TS:Create(v, TweenInfo.new(tweenTime, Enum.EasingStyle.Back, Enum.EasingDirection.In), {Size = v.Size * 1.5})
				ImpTween:Play()

				task.delay(tweenTime, function()
					v.Transparency = 1
					v.Anchored = true
					v.CanCollide = false
					
					coroutine.wrap(function()
						for l, k in pairs(script.ImplosionFX:GetChildren()) do
							local fx = k:Clone()
							fx.Parent = v
							fx:Emit(fx:GetAttribute("EmitCount"))
						end
					end)()
					
					
					for l = 1, random:NextInteger(1, 3) do
						local partSize = random:NextNumber(0.2, 0.6)
						
						local part = partCache:GetPart()
						part.Size = Vector3.new(partSize, partSize, partSize)
						part.Color = Colors[random:NextInteger(1, #Colors)]
						part.CFrame = v.CFrame * CFrame.new(math.random(-(v.Size.X / 2), (v.Size.X / 2)), math.random(-(v.Size.Y / 2), (v.Size.Y / 2)), math.random(-(v.Size.Z / 2), (v.Size.Z / 2)))
						part.Parent = workspace.Debris
						
						TS:Create(part, TweenInfo.new(0.7), {Color = Colors[random:NextInteger(1, #Colors)]}):Play()
						
						task.delay(random:NextNumber(0.3, 0.7), function()
							TS:Create(part, TweenInfo.new(0.7), {Size = Vector3.new()}):Play()
							task.delay(0.7, function()
								partCache:ReturnPart(part)
							end)
						end)
						task.wait()
					end
				end)

			end
		end
	end)	
end
