For what you want to achieve, you can tween the transparency of the frame to 1, as soon as it is set to 1, you can set Visible to false, and vice-versa.
Heres an example:
local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
local frame = path.to.frame
local tween = ts:Create(frame, tweenInfo, { BackgroundTransparency = 1 })
tween:Play()
tween.Completed:Wait()
frame.Visible = false
also this is offtopic, but you can shorten your current code to be:
frame.Visible = not frame.Visible
Heres how you can implement it:
local ts = game:GetService("TweenService")
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
if debounce then return end
debounce = true
local transparency = frame.Visible and 1 or 0
local info = TweenInfo.new(1, Enum.EasingStyle.Linear)
local tween = ts:Create(frame, info, { BackgroundTransparency = transparency })
tween:Play()
tween.Completed:Wait()
frame.Visible = not frame.Visible
debounce = false
end)