I want it to create another tab in chat that u click on like shown in the picture but it just isnt creating the new tab
local Players = game:GetService("Players")
local trainingCreated = false
TextChatService.OnIncomingMessage = function(message)
local player = message.TextSource and Players:GetPlayerByUserId(message.TextSource.UserId)
if not player then return end
local msg = message.Text:lower()
local chatUser = TextChatService:FindFirstChild(player.Name)
if msg == "!trainingchat" then
if not trainingCreated then
local trainingChannel = Instance.new("TextChannel")
trainingChannel.Name = "Training"
trainingChannel.AutoJoin = false
trainingChannel.Parent = TextChatService
trainingCreated = true
end
local channel = TextChatService:FindFirstChild("Training")
if chatUser and channel then
channel:AddUserAsync(chatUser)
end
return nil
end
if msg == "!endtraining" then
local channel = TextChatService:FindFirstChild("Training")
if chatUser and channel then
channel:RemoveUserAsync(chatUser)
end
return nil
end
return message
end
this is my script in serverscriptservice