My goal is to make a three-tab menu with a tweening effect. While the visuals are fine, there’s an as of yet unknown error in the Boolean debouncing method I’m using that causes the menu to clash together.
The below is how the menu is expected to work. However, if you had clicked the Gamepass tab before the Daily or Mystery tabs, you’d get a strange clash between the Gamepass and other tabs as shown:
The script itself is only about 183 lines long, minus any local variables like Tween information and Instances. To hopefully save space, this only includes the Functions and actual code.
I believe the problem lies within the Boolean combinations.
-- Abridged script
-- Functions
--- Cleanup Functions
local function cleanDailyStuff() -- Cleans out Daily Menu.
dailyActive = false
tweenDailyBaseSliderLocation:Play()
print("Daily stuff cleaned!")
end
local function cleanPassStuff() -- Cleans out Gamepass Menu.
passActive = false
tweenPassBaseSliderLocation:Play()
print("Gamepass stuff cleaned!")
end
local function cleanMysteryStuff() -- Cleans out Mystery Packs Menu.
mysteryActive = false
tweenMysteryBaseSliderLocation:Play()
tweenMysteryBaseSliderLocation.Completed:Connect(function()
tweenRegularSize:Play()
mysterySizeCheck = false
tweenBaseStatBoxLocation:Play()
end)
print("Mystery stuff cleaned!")
end
--- Start Functions
local function startMysteryMenu()
mysteryActive = true
tweenMysteryColour:Play()
tweenMysterySize:Play()
tweenActiveStatBoxLocation:Play()
tweenMysterySize.Completed:Connect(function()
mysterySizeCheck = true
tweenMysteryActiveSliderLocation:Play()
wait(coolTime)
changeCooldownBool = false
end)
end
-- Code!
dailyButton.MouseButton1Click:Connect(function() -- Daily Deals
if changeCooldownBool == false then -- Make sure nothing is currently running.
wait()
if passActive == true and mysteryActive == false then -- Pass is Active, Mystery isn't Active.
cleanPassStuff()
changeCooldownBool = true
dailyActive = true
tweenDailyColour:Play()
tweenDailyColour.Completed:Connect(function()
tweenDailyActiveSliderLocation:Play()
wait(coolTime)
changeCooldownBool = false
print("Daily now Active after Pass!")
end)
elseif passActive == false and mysteryActive == true then -- Pass isn't Active, Mystery is Active.
changeCooldownBool = true
dailyActive = true
cleanMysteryStuff()
tweenRegularSize.Completed:Connect(function()
tweenDailyColour:Play()
tweenDailyActiveSliderLocation:Play()
wait(coolTime)
changeCooldownBool = false
print("Daily now Active after Mystery!")
end)
end
end
end)
passButton.MouseButton1Click:Connect(function() -- Gamepasses
wait()
if changeCooldownBool == false then -- Make sure nothing is currently running.
wait()
if dailyActive == true and mysteryActive == false then -- Daily is Active, Mystery isn't Active.
changeCooldownBool = true
cleanDailyStuff()
passActive = true
tweenPassColour:Play()
tweenPassColour.Completed:Connect(function()
tweenPassActiveSliderLocation:Play()
wait(coolTime)
changeCooldownBool = false
print("Pass now Active!")
end)
elseif dailyActive == false and mysteryActive == true then -- Daily isn't Active, Mystery is Active.
cleanMysteryStuff()
changeCooldownBool = true
passActive = true
tweenPassColour:Play()
tweenPassColour.Completed:Connect(function()
tweenPassActiveSliderLocation:Play()
wait(coolTime)
changeCooldownBool = false
print("Pass now Active!")
end)
end
end
end)
mysteryButton.MouseButton1Click:Connect(function() -- Mystery Packs - Special! Extra parts, crispy in milk!
wait()
if changeCooldownBool == false then -- Make sure nothing is currently running.
wait()
if mysterySizeCheck == false and dailyActive == true then
changeCooldownBool = true
cleanDailyStuff()
tweenDailyBaseSliderLocation.Completed:Connect(function()
startMysteryMenu()
end)
elseif changeCooldownBool == false and passActive == true then
changeCooldownBool = true
cleanPassStuff()
tweenPassBaseSliderLocation.Completed:Connect(function()
startMysteryMenu()
end)
end
end
end)
However, if you wish to view the full script and menu, below is the game file:
Shop Menu New - Abridged.rbxl (49.5 KB)
Apologies in advance for such a large request.