Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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

1local function Run(ChatService)
2 
3    local staffChannel = ChatService:AddChannel("Staff")
4 
5    staffChannel.WelcomeMessage = "Welcome to the staff chat! Grammar is still required in this chat, only staff can see this channel."
6    staffChannel.Joinable = false
7 
8 
9end

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 answer

Log in to vote
2
Answered by
Kikitob 105
6 years ago

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

01local Group = 0
02local Rank = 100
03local function Run(ChatService)
04 
05    local staffChannel = ChatService:AddChannel("Staff")
06 
07    staffChannel.WelcomeMessage = "Welcome to the staff chat! Grammar is still required in this chat, only staff can see this channel."
08    staffChannel.Joinable = false
09 
10    ChatService.SpeakerAdded:Connect(function(Speaker)
11        if Speaker.PlayerObj and Speaker.PlayerObj:GetRankInGroup(Group) >= Rank then
12            staffChannel:InternalAddSpeaker(Speaker)
13        end
14    end)
15end
0
Thanks! UltraaaDev 85 — 6y
Ad

Answer this question