How do I detect if the Chat button in the top bar is checked or not?
Thanks for helping!
I believe what you’d want is StarterGui:SetCore
’s function? You can set the first parameter as CoreGuiChatConnections
, and the second parameter would be a table of BindableEvents/Functions for the Chat to detect:
You can do this using StarterGui | Roblox Creator Documentation. An example of this might be:
local StarterGui = game:GetService("StarterGui")
local Enabled = StarterGui:GetCoreGuiEnabled("Chat")
if Enabled then
print("Enabled")
else
print("Disabled")
end
I’ve got it:
RunService.RenderStepped:Connect(function()
if StarterGui:GetCoreGuiEnabled("ChatActive") then
-- Chat icon is activated
else
-- Chat icon isn't activated
end
end)
LocalScript inside StarterGui or PlayerScripts
Code:
local Chat = game.Players.LocalPlayer.PlayerGui:WaitForChild(“Chat”)
local ChatFrame = Chat:WaitForChild(“Frame”)
local ChatIsOpen = ChatFrame.Visible
ChatFrame.Changed:Connect(function(Property)
if Property == “Visible” then
ChatIsOpen = ChatFrame.Visible
end
end)
This is more reliable
local ChatActive
local ChatTextBox = LclPlr.PlayerGui:WaitForChild("Chat"):WaitForChild("Frame"):WaitForChild("ChatBarParentFrame"):WaitForChild("Frame"):WaitForChild("BoxFrame"):WaitForChild("Frame"):WaitForChild("TextLabel")
local function UpdateChatActive()ChatActive = not ChatTextBox.Visible end
UpdateChatActive()
ChatTextBox:GetPropertyChangedSignal("Visible"):Connect(UpdateChatActive)
it’s StarterGui:GetCore("ChatActive")
, not StarterGui:GetCoreGuiEnabled("ChatActive")
Anyone checking deprecation notices should know that, why are you bunping an outdated code question?
I don’t know what you’re saying is deprecated. GetCoreGuiEnabled never worked the way you describe, it only ever accepted an Enum. The string you provided is one out of a list of strings which are designed to work with GetCore.
Tell me where else you can check for this condition. As far as I know, this is not an outdated topic, and is as relevant now as it was when it was posted.