What the script is trying to accomplish:
I am making new TextChannels and assigning them to people when they join that team.
The issue:
The issue is that it won’t assign the TextChannel when you join the team. There shouldn’t be an issue with the Channel tabs being disabled as I already enabled them in studio. I do think the issue could be with the events as they are not firing.
-- Services ----------
local TextChatService = game:GetService("TextChatService")
local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
-- Variables ----------
local TextChannels = TextChatService:WaitForChild("TextChannels")
-- Functions ----------
function NewChannel(ChannelName)
local Channel = Instance.new("TextChannel", TextChannels)
Channel.Name = ChannelName
end
-- RunTime ----------
NewChannel("Sheriff Radio")
NewChannel("Firefighter Radio")
NewChannel("DOT")
Teams:WaitForChild("Sheriff").PlayerAdded:Connect(function(Player)
TextChannels["Sheriff Radio"]:AddUserAsync(Player.UserId)
end)
Teams:WaitForChild("Firefighters").PlayerAdded:Connect(function(Player)
TextChannels["Firefighter Radio"]:AddUserAsync(Player.UserId)
end)
Teams:WaitForChild("DOT").PlayerAdded:Connect(function(Player)
TextChannels.DOT:AddUserAsync(Player.UserId)
end)