Visibility/tweening doesn't work

designing a complicated number line UI and it just doesn’t show/animate. the idea is when you press the button a condensed and small version of a number line shows up but after a tiny bit it tweens out to the actual number line with interactable buttons (functionality not programmed yet)

problem is nothing shows up when i press the button. my script is huge so i warn you

local Out = {
	["arrowleft"] = UDim2.new(0.04,0,0.5,0),
	["arrowright"] = UDim2.new(0.953,0,0.5,0),
	["linepos"] = UDim2.new(0.5,0,0.5,0),
	["linesize"] = UDim2.new(0,425,0,3),
	["one"] = true,
	["two"] = true,
	["zero"] = true,
	["onefive"] = true,
	["zerofive"] = true,
	["containerpos"] = UDim2.new(0.5,0,0.85,0),
	["containersize"] = UDim2.new(0,450,0,40),
	["containerUIARC"] =  11.25,
	["lineUIARC"] = 141.667
}
local In = {
	["arrowleft"] = UDim2.new(0.25,0,0.5,0),
	["arrowright"] = UDim2.new(0.743,0,0.5,0),
	["linepos"] = UDim2.new(0.5,0,0.5,0),
	["linesize"] = UDim2.new(0,30,0,3),
	["one"] = false,
	["two"] = false,
	["zero"] = false,
	["onefive"] = false,
	["zerofive"] = false,
	["containerpos"] = UDim2.new(0.5,0,0.85,0),
	["containersize"] = UDim2.new(0,50,0,40),
	["containerUIARC"] =  1.25,
	["lineUIARC"] = 10
}
local state = "In"
local isVisible = false
local bar = script.Parent.scalecontainer
local button = script.Parent.container.timescale
local line = bar.line
local one = line.one
local two = line.two
local zero = line.zero
local zerofive = line.zerofive
local onefive = line.onefive
local arrowleft = bar.arrowleft
local arrowright = bar.arrowright
local ts = game:GetService("TweenService")
local tiout = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local tiin = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
local rs = game:GetService("RunService")
local db = false
local visibilityState = false

function TweenOut(	)
	ts:Create(arrowleft,tiout,{Position = Out["arrowleft"]}):Play()
	ts:Create(arrowright,tiout,{Position = Out["arrowright"]}):Play()
	ts:Create(line,tiout,{Position = Out["linepos"], Size = Out["linesize"]}):Play()
	ts:Create(bar,tiout,{Position = Out["containerpos"], Size = Out["containersize"]}):Play()
	task.wait(0.75)
	one.Visible = Out["one"]
	two.Visible = Out["two"]
	zero.Visible = Out["zero"]
	zerofive.Visible = Out["zerofive"]
	onefive.Visible = Out["onefive"]
	bar.UIAspectRatioConstraintBar.AspectRatio = Out["containerUIARC"]
	line.UIAspectRatioConstraintLine.AspectRatio = Out["lineUIARC"]
end

function TweenIn()
	one.Visible = In["one"]
	two.Visible = In["two"]
	zero.Visible = In["zero"]
	zerofive.Visible = In["zerofive"]
	onefive.Visible = In["onefive"]
	bar.UIAspectRatioConstraintBar.AspectRatio = In["containerUIARC"]
	line.UIAspectRatioConstraintLine.AspectRatio = In["lineUIARC"]
	ts:Create(arrowleft,tiin,{Position = In["arrowleft"]}):Play()
	ts:Create(arrowright,tiin,{Position = In["arrowright"]}):Play()
	ts:Create(line,tiin,{Position = In["linepos"], Size = In["linesize"]}):Play()
	ts:Create(bar,tiin,{Position = In["containerpos"], Size = In["containersize"]}):Play()
	task.wait(0.75)
end

function visibilityToggle(visibility)
	if visibility then
		if not visibilityState then
			visibilityState = true
			bar.Visible = true
			arrowright.Visible = true
			arrowleft.Visible = true
			line.Visible = true
			TweenIn()
		end
	else
		if visibilityState then
			visibilityState = false
			TweenOut()
			bar.Visible = false
			arrowright.Visible = false
			arrowleft.Visible = false
			line.Visible = false
		end
	end
end

button.Activated:Connect(function() -- good luck trying to read this lol
	if not db then db = not db end
	if visibilityState then visibilityState = not visibilityState else visibilityState = not visibilityState end
	if state == "In" then state = "Out" visibilityToggle(visibilityState) task.wait(0.5) TweenOut() elseif state == "Out" then state = "In" visibilityToggle(visibilityState) task.wait(0.5) TweenIn() end
	task.wait(2)
	db = not db
end)

I just have a theory but I believe it is this part. Both of them are unnecessary because what value not value does is just makes it so that boolean value becomes the opposite of what it was, such as true value becomes false
and false value becomes true,
As such your debounce variable just goes in weird circles and actually is never turned off properly.

if visibilityState then 
       visibilityState = not visibilityState 
       else 
       visibilityState = not visibilityState 
end


button.Activated:Connect(function() -- good luck trying to read this lol
	if not db then db = not db end
	if visibilityState then visibilityState = not visibilityState else visibilityState = not visibilityState end
	if state == "In" then state = "Out" visibilityToggle(visibilityState) task.wait(0.5) TweenOut() elseif state == "Out" then state = "In" visibilityToggle(visibilityState) task.wait(0.5) TweenIn() end
	task.wait(2)
	db = not db
end)

Instead you should do something like this

if db == false then
db = true
wait(1)
db = false
end

Sorry, wasn’t able to reply, do you mean this?

button.Activated:Connect(function()
	if db == false then db = true task.wait(2) db = false end
	if visibilityState then visibilityState = not visibilityState else visibilityState = not visibilityState end
	if state == "In" then state = "Out" visibilityToggle(visibilityState) task.wait(0.5) TweenOut() elseif state == "Out" then state = "In" visibilityToggle(visibilityState) task.wait(0.5) TweenIn() end
end)

or this

button.Activated:Connect(function()
	if db == false then
		db = true
		if visibilityState then visibilityState = not visibilityState else visibilityState = not visibilityState end
		if state == "In" then state = "Out" visibilityToggle(visibilityState) task.wait(0.5) TweenOut() elseif state == "Out" then state = "In" visibilityToggle(visibilityState) task.wait(0.5) TweenIn() end
		task.wait(2)
		db = false
	end
end)

Technically either works but I’d get into the habit of making more lines so you can understand code better, as having more lines isn’t a bad thing it’s all about how optimized the code runs that you should look into.