Dropdown Menu Only Selecting 1 Option [RESOLVED]

Hi,

I’m working on a game with my cousin, which is similar to those of a WWE clean wrestling game, and I am working on a dropdown menu using TopbarPlus V3. I created all of the icons, but I was just having a problem.

Whenever I go to selected to turn off the roof while day time is on, it would revert the time back to night, but toggle off the roof. I’ve tried something with the icon properties, but that didn’t seem to work. Could anyone help me on why its doing this and how to fix it?

I provied the script below, as well as a video to show what is going on for people who are usually visual learners.

local container = script.Parent
local Icon = require(container.Icon)

--// Main Icons
local Settings = Icon:new()

--// Configurations
Settings:align("Center")
Settings:setImage(6031280882)
Settings:setImageScale(0.6)
Settings:setCaption("Options")
Settings:setDropdown({
	Icon.new()
		:setLabel("Remove Chairs")
		:bindEvent("deselected", function()
			game.Workspace.Seats_Metal:Destroy()
		end)
		:oneClick()
	,
	Icon.new()
		:setLabel("✅ | Crowd", "deselected")
		:bindEvent("deselected", function()
			game.Workspace["Large Arena Crowd Ambience"]:Play()
		end)
		:setLabel("❌ | Crowd", "selected")
		:bindEvent("selected", function()
			game.Workspace["Large Arena Crowd Ambience"]:Stop()
		end)
	,
	Icon.new()
		:setLabel("✅ | Roof", "deselected")
		:bindEvent("deselected", function()
			game.Workspace.Stadium.Stadium.Roof.Transparency = 0
		end)
		:setLabel("❌ | Roof", "selected")
		:bindEvent("selected", function()
			game.Workspace.Stadium.Stadium.Roof.Transparency = 1
		end)
	,
	Icon.new()
		:setLabel("❌ | Day", "deselected")
		:bindEvent("deselected", function()
			game.Lighting.ClockTime = 0
		end)
		:setLabel("✅ | Day", "selected")
		:bindEvent("selected", function()
			game.Lighting.ClockTime = 12
		end)
})

Holy moly I’ve been trying to figure this out for so long only to find the solution to be very simple:

Set autoDeselect to false for both icons by adding:

:autoDeselect(false)
right below both icons

Icon.new()
        :autoDeselect(false) -- Self explanatory; It will prevent the icons from automatically deselecting
		:setLabel("✅ | Roof", "deselected")
		:bindEvent("deselected", function()
			game.Workspace.Stadium.Stadium.Roof.Transparency = 0
		end)
		:setLabel("❌ | Roof", "selected")
		:bindEvent("selected", function()
			game.Workspace.Stadium.Stadium.Roof.Transparency = 1
		end)
	,
	Icon.new()
        :autoDeselect(false) -- Same here
		:setLabel("❌ | Day", "deselected")
		:bindEvent("deselected", function()
			game.Lighting.ClockTime = 0
		end)
		:setLabel("✅ | Day", "selected")
		:bindEvent("selected", function()
			game.Lighting.ClockTime = 12
		end)
1 Like

I never expected to take very long just find a simple line of code…lol.
Anyway, this did indeed work. Thank you for the help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.