How to get template id from shirt id in a script?
You might have to do it manually by finding the image,
Go to a shirt, keep substracting 1 from the ID, if it redirects you to a place, go back one page and then skip that part.
For example,
"312321321" - substract one, you'd get "312321320" if the url still says that it is a "library" or a "catalog" item, you can keep substracting until you get the image id.
if "312321319" is a place, go back to 312321320 and then skip 312321319.
Which means your next link should be 312321318
Keep doing this until you can find the template (image).
if you don't get what I mean, just post a comment.
EDIT: If I comprehensed your question wrong, and you're saying that you already have the shirt, you can just go into properties and find for "ShirtTemplate"
shirt = game.Workspace.Shirt print(shirt.ShirtTemplate)