First Number Node
A one-line helper with a temper
- first_digit
In a pack full of odd little utilities, this is the oddest little utility. It takes an integer, hands you its first digit, and does literally nothing else. Feed it 4321, you get 4. That's the node. Its display name is even a misnomer in the other direction - it's called First Number Node, the class is FirstLetterNode, and the underlying Python class is FirstDigitNode. Pick whichever label you find least confusing.
How it works
One input, one output:
- number (INT) - the integer you're peeling a digit off.
- first_digit (INT) - the first digit of that number, as an integer.
The mechanism is a str(number)[0] cast back to int. Nothing more. Why would you want that? The classic use is selection-by-leading-digit: if your workflow has ten slots, items, or options indexed 0–9, a batch ID like 4321 can become the selector 4 with one node. In this pack's Roblox-asset context, that's a cheap way to map an asset number to one of ten sticker or decal slots.
The other nine use cases... there aren't any. It's a helper node, and it's honest about being one.
Where it bites
The temper is the gotcha. The code only accepts integers greater than zero:
if isinstance(number, int) and number > 0:
first_digit = int(str(number)[0])
else:
raise ValueError("La entrada debe ser un número entero positivo.")
Feed it 0, -7, or anything non-integer, and it raises a ValueError that kills the whole queue - no fallback, no warning, just an exception mid-graph. If you're feeding it from a seed or a counter that can hit zero, clamp the value first or wrap it in a node that guarantees positive integers. For the same reason, a number like 0421 won't behave the way a string-trimming brain might expect - it's an int, so the leading zero is gone before the node ever sees it.
Installing it
Same pack, same install as everything else in roblox-comfyui-nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/VertexStudio/roblox-comfyui-nodes
Restart ComfyUI, or search roblox-comfyui-nodes in ComfyUI Manager. No dependencies beyond what ComfyUI already ships. It appears under Custom Nodes as "First Number Node".
Should you even bother?
Honest answer: for a single digit, probably not. Any expression-evaluator node (rgthree's Power Puter, or any of the JS/python-eval utilities) does int(str(x)[0]) with a real clamp and a readable error. This one exists because the pack author needed it for a specific pipeline and published it. It works, it's zero-dependency, and if you're already running the pack it costs you nothing - just respect the positive-integer rule and you'll never see the error message.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| number | INT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| first_digit | INT | — |