local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")

local autoWelcomeEnabled = true

local GeneralChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")

Players.PlayerAdded:Connect(function(plr)
    if autoWelcomeEnabled then
        task.wait(2)
        pcall(function()
            GeneralChannel:SendAsync("welcome " .. plr.DisplayName)
        end)
    end
end)

Players.PlayerRemoving:Connect(function(plr)
    if autoWelcomeEnabled then
        pcall(function()
            GeneralChannel:SendAsync("goodbye " .. plr.DisplayName)
        end)
    end
end)
