Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I restrict a custom channel (ChatService) to a certain group?

I've currently got this for making a staff channel:

local function Run(ChatService)

    local staffChannel = ChatService:AddChannel("Staff")
 
    staffChannel.WelcomeMessage = "Welcome to the staff chat! Grammar is still required in this chat, only staff can see this channel."
    staffChannel.Joinable = false
    

end

I want to make it so only rank ... from group ... can see and enter/leave the chat. But I can't find much documentation

1 comment

1 answer

✓ Accepted answer

Here you go, you just have to change Group and Rank and then it should work.

local Group = 0
local Rank = 100
local function Run(ChatService)

    local staffChannel = ChatService:AddChannel("Staff")

    staffChannel.WelcomeMessage = "Welcome to the staff chat! Grammar is still required in this chat, only staff can see this channel."
    staffChannel.Joinable = false

	ChatService.SpeakerAdded:Connect(function(Speaker)
		if Speaker.PlayerObj and Speaker.PlayerObj:GetRankInGroup(Group) >= Rank then
			staffChannel:InternalAddSpeaker(Speaker)
		end
	end)
end

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.