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:

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 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.

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
0
Thanks! UltraaaDev 85 — 6y
Ad

Answer this question