Hello,
Recently I’ve been working on a game for a group where I’ve been required to apply some TextChannels to higher ranking members of the group - which I have already programmed to work successfully - but I came across an issue with that being I was unable to completely revoke a user’s access to a TextChannel after having previously granted it via TextChannel:AddUserAsync(): users were still able to see the channel that they were in before being revoked, and the users were still, yes, able to type messages in that channel, however the messages that the user attempted to send in that channel didn’t get through to the other players (see Figure 1 below):
Figure 1: Typing two messages into the chat, then removing the TextSource of the player server-side, then attempting to send another message in the chat.
The case shown above accounted for any channel by default, including the above which shows the most relevant issue about the happening that this is default to players changing teams too and not being able to revoke access to those team-only channels instantly.
The main issue I had with this on my end was that, for this system I’m working on, a part of it includes a Typing Indicator which I have already programmed; the system relies on showing only players who are part of specific channels the typing indicator, and if channels which have been attempted to have been revoked from users’ access are still there, the system still looks at the ChatInputBarConfiguration.TargetTextChannel and sees that the user is typing in that channel, which should not be happening.
I researched on the official Roblox Documentation before messaging here, and found out about TextSources. I noticed on the documentation that where it mentioned how to “Remove TextSources”, the documentation was clearly wrong for the fact that it mentioned that the removal of TextSources was done via “calling TextSource.Destroy
” (see Figure 2 below):
Figure 2: Searching on TextSource | Documentation - Roblox Creator Hub shows the incorrectly documented method of how to destroy a TextSource.
I assumed this was incorrect for the fact that it should be done through the usual usage of Instance:Destroy(), and so after taking no chances and naturally having tried to run game.TextChatService.CustomChannels.Staff.GreenTheBlaze.Destroy()
(see Figure 3 below), I tried out by running the following into the Developer Console in-game, and also the Command Bar on Studio: game:GetService("TextChatService").CustomChannels.Staff:FindFirstChild("GreenTheBlaze"):Destroy()
.
Figure 3: The expected erroneous result of having tried to call a method through the incorrect use of the dot operator to call a function.
After having removed the TextSource, as mentioned before, the user could still see the channel but messages again did not go through to the other players who had access to the same channel.
Any help and advice on how I can go about removing access from players to TextChannels would be much appreciated!