Command Only working with certain amount of people on?

Hello, I want to make this code


ITEM.Name = 'Buy Once: Traitor'
ITEM.Price = 2000
ITEM.Material = 'VGUI/ttt/sprite_traitor.vmt'
ITEM.OneUse = true
 
function ITEM:OnEquip(ply, modifications)
    hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function()
        if ply:GetRoleString() != "traitor" then
            ply:SetRole(ROLE_TRAITOR)
            ply:AddCredits(GetConVarNumber("ttt_credits_starting"))
        end
 
        if SERVER then
            ply:PS_TakeItem(self.ID)
        end
 
        hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor")
    end)
end
 
function ITEM:OnHolster(ply)
    hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor")
end
 
function ITEM:OnSell(ply)
    hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor")
end

only usable when there are over 8 people on the server.

Is this possible?


Function: CanPlayerBuy
Arguments: ply (Player)
Realm: Server
Required: No
Description: Called when the player tries to buy the item. Return true or false.
Example:

function ITEM:CanPlayerBuy(ply)
    return ply:Alive() -- only if alive
end

Assuming that this would work:


function ITEM:CanPlayerBuy(ply)
     local plys = #player.GetAll()
     return plys > 8
end

Can I make it so it comes up with a message if it fails Eg There are not enough people on atm.