Hello! I am trying to achieve having custom text channels for admins and removing the team channel.
What I’ve done is remove the standard chats, add the admin chat and a general chat. Now the problem is that when I join i have access to these chats but it doesn’t automatically set me in the General chat (or any other chat either), which means i have to press the General chat from the topbar to start chatting.
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local AdminModule = require(game.ServerScriptService.AdminServer.AdminModule)
local Channels = {
{
Name = "DevChat",
JoinRequirement = function(player)
local rank = AdminModule.GetUserRank(player,false)
return rank >= 201
end
},
{
Name = "ModeratorChat",
JoinRequirement = function(player)
local rank = AdminModule.GetUserRank(player,false)
return rank >= 101
end
},
{
Name = "General",
JoinRequirement = function(player)
return true
end
},
}
local ChannelObjects = {}
for _, info in ipairs(Channels) do
local channel = Instance.new("TextChannel")
channel.Name = info.Name
channel.Parent = TextChatService
ChannelObjects[info.Name] = {
Instance = channel,
Requirement = info.JoinRequirement
}
end
Players.PlayerAdded:Connect(function(player)
for name, data in pairs(ChannelObjects) do
if data.Requirement(player) then
data.Instance:AddUserAsync(player.UserId)
end
end
end)
Thanks in advance!