I cant find ANYTHING to update visibility of my custom chat along with the core ChatActive, because GetCore only does it once…
That leads up to using loops
A terrible solution which is a no for me.
This is a pain im dealing with for a month now.
Yes i did go through devforums, and yes i found nothing related besides some bandage fix slaps that only work for PC users.
(Like doing it on a slash key and all that… Surely console/mobile players will magically be able to press the slash key right? And surely no one in their life would click on chat button instead hm??)
I even asked several AI CHATBOTS of all things as my last resort and STILL its left unsolved.
Simply doing something like this will only print the time the local was set, meaning i gotta do GetCore another time to find out the change happened.
local ChatActive = game:GetService("StarterGui"):GetCore("ChatActive")
while true do
task.wait(0.2)
print(ChatActive)
end
And here’s my current loop implementation, i need something that wouldn’t be a loop since that just affects performance. Which is why im here overall making this post.
local lastChatState = StarterGui:GetCore("ChatActive")
local function updateGUI()
local currentChatState = StarterGui:GetCore("ChatActive")
if currentChatState ~= lastChatState then
MainGUI.Enabled = currentChatState
lastChatState = currentChatState
end
end
task.spawn(function()
while true do
updateGUI()
task.wait(0.050)
end
end)
What do i need?
A proper way to detect ChatActive changes without relying on loops.
No RenderStepped, Heartbeat, or any other loop-based approach.
Removing the default chat icon and replacing it with a custom one is not an option. (Could be if its really impossible otherwise though.)
I’m looking for a signal-based solution (If one even exists, i’d like to also hear a straightforward “no” if its really not possible).
I cant simply check when i use SetCore.
What i’ve meant by all this is the standard ways of firing, like clicking on the button itself, using the button from console menu. All that is a CoreGui part that i cannot check.=
Here’s the thing. I don’t.
I get what you mean by doing a bindable near SetCore, but i haven’t used it at all in my scripts.
So tracking changes is gonna be done from CoreGui which cant be accessed to normal users, which is why i have to use StarterGui:GetCore()
Original chat and all that is already disabled obviously.
What i need is simply update visibility of custom chat when ChatActive was changed to either true or false
This is not possible, CoreGui cannot be accessed and no services expose this functionality. You should create your own button and connect a listener to it, or use a loop.
Obvious!
Which is why im searching for some kinda signal based approach.
Not directly a signal of course, since ChatActive is not a property, but something!
Thats quite stupid if there’s no way to check when a GetCore part was changed.
What i’ve meant is… Its a bandage fix, i would only get to doing it if there’s really no main way i wanted it to be. It is applicable! But not what i was aiming for.
I even mentioned those in the original main post.
(In short, just a last resort if nothing is found. Prolly gonna take a day or two before closing. Maybe someone finds a way.)
There really is no way to track this through signals, since Roblox does not want scripts to have direct read access to the core gui and does not provide a signal for this use case.
I suggest not using a while true loop though, and instead use a RenderStepped. The while true should be on every devs ‘no no’ list in my opinion.
Also, the if statement above is not needed. if you try to set a property to what it already is set to, Roblox does nothing. After stress testing it, I have come to the conclusion that it does not affect performance. This is just a picky thing that would allow the code to be cleaner.
I would accept the bandage fix or make a feature request as others have already stated. There is no other way. I mean, if Roblox does not let us directly access the objects that these properties would be located, and doesn’t provide us an event signal to connect to, how could we possible set up a signal connection?
And if this loop somehow causes performance issues for a game, that wouldn’t be the loops fault.
I would chase efficiency in other areas that can have a much greater effect on performance .