You can have dropdown buttons that contain menus and vice versa, but menu buttons cant directly contain menus and similarly dropdown buttons cant directly contain dropdowns.
You can achieve this with a module script. More info here:
umm I just forked the chat script and made my custom mimic button:
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local GuiService = game:GetService("GuiService")
local Players = game:GetService("Players")
local TopbarPlusReference = ReplicatedStorage:FindFirstChild("TopbarPlusReference")
local IconModule = ReplicatedStorage.Modules.Icon
local LocalPlayer = Players.LocalPlayer
if not LocalPlayer then
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
LocalPlayer = Players.LocalPlayer
end
if TopbarPlusReference then
IconModule = TopbarPlusReference.Value
end
local PlayerScripts = LocalPlayer:WaitForChild("PlayerScripts")
local ChatScript = PlayerScripts:WaitForChild("ChatScript")
local ChatEvents = ChatScript:WaitForChild("ChatEvents")
local IconController = require(IconModule.IconController)
local ChatMain = require(ChatScript.ChatMain)
local Themes = require(IconModule.Themes)
local Maid = require(IconModule.Maid)
local Icon = require(IconModule)
local ChatMimic = Icon.new()
local ChatMaid = ChatMimic._maid
ChatMimic._FakeChatMaid = ChatMaid:give(Maid.new())
ChatMimic:setName("ChatMimic")
ChatMimic:setOrder(-1)
ChatMimic:setImage("rbxasset://textures/ui/TopBar/chatOff.png", "deselected")
ChatMimic:setImage("rbxasset://textures/ui/TopBar/chatOn.png", "selected")
ChatMimic:setTheme(Themes.BlueGradient)
ChatMimic:setImageYScale(0.625)
Maid.ChatMimicCleanup = function()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, ChatMimic.enabled)
end
local function DisplayChatBar(Visibility)
ChatMimic.ignoreVisibilityStateChange = true
ChatMain.CoreGuiEnabled:fire(Visibility)
ChatMain.IsCoreGuiEnabled = false
ChatMain:SetVisible(Visibility)
ChatMimic.ignoreVisibilityStateChange = nil
end
local function SetIconEnabled(Visibility)
ChatMimic.ignoreVisibilityStateChange = true
ChatMain.CoreGuiEnabled:fire(Visibility)
ChatMimic:setEnabled(Visibility)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
ChatMimic:deselect()
ChatMimic.updated:Fire()
ChatMimic.ignoreVisibilityStateChange = nil
end
ChatMimic._FakeChatMaid:give(UserInputService.InputEnded:Connect(function(InputObject, GameProcessedEvent)
if GameProcessedEvent then
return "Another menu has priority"
elseif not(InputObject.KeyCode == Enum.KeyCode.Slash or InputObject.KeyCode == Enum.SpecialKey.ChatHotkey) then
return "No relavent key pressed"
elseif ChatMain.IsFocused() then
return "Chat bar already open"
elseif not ChatMimic.enabled then
return "Icon disabled"
end
ChatMain:FocusChatBar(true)
ChatMimic:select()
end))
ChatMimic._FakeChatMaid:give(ChatEvents.VisibilityStateChanged.Event:Connect(function(Visibility)
if not ChatMimic.ignoreVisibilityStateChange then
if Visibility == true then
ChatMimic:select()
else
ChatMimic:deselect()
end
end
end))
ChatMimic.deselectWhenOtherIconSelected = false
ChatMimic._FakeChatMaid:give(ChatEvents.MessagesChanged.Event:Connect(function()
if ChatMain:GetVisibility() == true then
return "ChatWindow was open"
end
ChatMimic:notify(ChatMimic.selected)
end))
coroutine.wrap(function()
task.wait()
ChatMimic._FakeChatMaid:give(ChatEvents.CoreGuiEnabled.Event:Connect(function(NewState)
if ChatMimic.ignoreVisibilityStateChange then
return "ignoreVisibilityStateChange enabled"
end
local TopbarEnabled = StarterGui:GetCore("TopbarEnabled")
if TopbarEnabled ~= IconController.previousTopbarEnabled then
return "SetCore was called instead of SetCoreGuiEnabled"
end
if not ChatMimic.enabled and UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) and UserInputService:IsKeyDown(Enum.KeyCode.P) then
ChatMimic:setEnabled(true)
else
SetIconEnabled(NewState)
end
end))
end)()
ChatMimic.toggled:Connect(function()
DisplayChatBar(ChatMimic.isSelected)
end)
GuiService.MenuOpened:Connect(function()
if ChatMimic.isSelected then
DisplayChatBar(false)
end
end)
GuiService.MenuClosed:Connect(function()
if ChatMimic.isSelected then
DisplayChatBar(true)
end
end)
SetIconEnabled(StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Chat))
I’m using :set("iconBackgroundColor", Color3.fromRGB(255, 0, 0)).
The icon becomes black:
It is a selected icon that is locked from clicks.
Here’s the full constructor: