You could use rand to create the random number, I don't see anything in your script that actually selects any of the numbers from the $number list.
set number [rand 50]
(Hmm does rand ever select 0 as a number? Never checked on that..)
Then do the tests like:
if {$text == $number} {#exact match}
elseif {$text < $number} {# higher than}
elseif {$text > $number} {# greater than}
else {# not even in the ballpark}
I'd also do a
if {(![string is integer -strict $text]) || ($text < 0) || ($text > 50)} {
# tell the user the guess has to be a NUMBER between 1 and 50
}
Also, you do not provide any default/fallback error message, so of course it's just doing "return" and not saying anything cos it never matches because "1" is not the same as 1
{$text == "\"1\""}
would match IF the user typed
guess "1"
I'd put a default message in there after the else, at least something like
puthelp "PRIVMSG $nick :Nope, no number matched.."
return