Koki0991
(Koki)
December 8, 2023, 7:54pm
1
Does anyone know how to make the dropdown buttons get detected when the button is clicked?
Here is my code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Icon = require(ReplicatedStorage.Icon)
local IconController = require(ReplicatedStorage.Icon.IconController)
local icon = Icon.new()
IconController.voiceChatEnabled = true
icon:setLabel("Shop")
icon:setImage("rbxassetid://15578030072")
icon:setDropdown({
Icon.new():setLabel("Gold"):setCornerRadius(0, 0):setImage("rbxassetid://15578233381");
Icon.new():setLabel("Diamond"):setCornerRadius(0, 0):setImage("rbxassetid://15578359865");
})
2 Likes
Haystees
(Haystees)
December 8, 2023, 8:07pm
2
I just checked the api and found it pretty quickly:
local Icon = Icon.new()
Icon.userToggled:Connect(function ()
--your code
end)
Koki0991
(Koki)
December 8, 2023, 8:09pm
3
I know this way, it detects when the main button is clicked (the shop button). What I want is to detect when the drop-down menu buttons are clicked, like gold and diamond.
1 Like
Haystees
(Haystees)
December 8, 2023, 8:12pm
4
Well then i’d just move the new buttons up in scope and make the toggled reference elsewhere:
local icon = Icon.new()
IconController.voiceChatEnabled = true
icon:setLabel("Shop")
icon:setImage("rbxassetid://15578030072")
local GoldIcon = Icon.new()
GoldIcon:setLabel("Gold"):setCornerRadius(0, 0):setImage("rbxassetid://15578233381")
local DiamondIcon = Icon.new()
DiamondIcon:setLabel("Diamond"):setCornerRadius(0, 0):setImage("rbxassetid://15578359865")
icon:setDropdown({
GoldIcon;
DiamondIcon;
})
GoldIcon.userToggled:Connect(function ()
--Gold icon toggle
end)
DiamondIcon.userToggled:Connect(function()
--Diamond icon toggle
end)
1 Like
Koki0991
(Koki)
December 8, 2023, 8:23pm
5
This works, thank you so much.
Koki0991
(Koki)
December 8, 2023, 9:58pm
6
Hello, by the way, do you know how I can add an image to the left of the text?
system
(system)
Closed
December 22, 2023, 9:58pm
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.