Set Variable [$A ; value: YourTable::ID ]
Enter Find Mode 
Set Field [YourTable::ID ; $A ]
Set Error Capture [on]
Perform Find 
Set Variable [$Counts ; value: Get ( FoundCount ) ]
Set Field [YourTable::Number ; $Counts + 1 ]
However, it's possible you don't need a script at all for this. What is the purpose of this Number field?
I need a script because it's part of a large series of commands that will be performed from a button.
The idea is that i have some objects (ID) and for each of them I will create some other objects that will be numbered. so that at the end I'll have one record of each number, and multiple with the same ID.
You may be able to set up an auto-enter expression that does this for you without needing a script.