-- Module Script for function
local TweenService = game:GetService("TweenService")
local SoundService = game:GetService("SoundService")
local module = {
Appear_Function = function(Frame, AppearSound)
AppearSound:Play()
TweenService:Create(Frame, TweenInfo.new(AppearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
for i, v in Frame:GetDescendants() do
if v:IsA("Frame") then
TweenService:Create(v, TweenInfo.new(AppearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
elseif v:IsA("TextLabel") then
TweenService:Create(v, TweenInfo.new(AppearSound.TimeLength, Enum.EasingStyle.Linear), {TextTransparency = 0}):Play()
elseif v:IsA("UIStroke") then
TweenService:Create(v, TweenInfo.new(AppearSound.TimeLength, Enum.EasingStyle.Linear), {Transparency = 0}):Play()
elseif v:IsA("TextButton") then
TweenService:Create(v, TweenInfo.new(AppearSound.TimeLength, Enum.EasingStyle.Linear), {TextTransparency = 0}):Play()
end
end
end,
Disappear_Function = function(Frame, DisappearSound)
script.Parent:WaitForChild("ButtonSound").Enabled = true
DisappearSound:Play()
TweenService:Create(Frame, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
for i, v in Frame:GetDescendants() do
if v:IsA("Frame") then
TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
elseif v:IsA("TextLabel") then
TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {TextTransparency = 1}):Play()
elseif v:IsA("UIStroke") then
TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {Transparency = 1}):Play()
elseif v:IsA("TextButton") then
TweenService:Create(v, TweenInfo.new(DisappearSound.TimeLength, Enum.EasingStyle.Linear), {TextTransparency = 1}):Play()
end
end
end,
}
return module
-- Local script for the exit button
local SoundService = game:GetService("SoundService")
local TweenService = game:GetService("TweenService")
local ExitButton = script.Parent
local SettingsFrame = ExitButton.Parent
local Menu = SettingsFrame.Parent.Parent
local Sounds = Menu:WaitForChild("Sounds")
local DisappearSound = Sounds:WaitForChild("DisappearSound")
local Buttons = Menu:WaitForChild("Buttons")
local Button_Scripts = Buttons:WaitForChild("Buton_Scripts")
local Button_Module = require(Button_Scripts:WaitForChild("Button_Module"))
local debounce = false
ExitButton.MouseButton1Click:Connect(function()
if debounce == true then return end
debounce = true
Button_Scripts:WaitForChild("ButtonSound").Enabled = false
Button_Module.Disappear_Function(SettingsFrame, DisappearSound)
task.wait(2)
debounce = false
end)
When I click the exit button to have a “fade effect” to fade out, it does NOT work. It only plays the sound and the code below it does NOT run even though it should and I’m pretty sure I’ve done everything correctly.