hot key from within the applescript

Hi everyone! I hope you can help me.

I really want to be able to make a portion of an applescript run when you do a key combination. For instance, if you do command-T it runs your script.

I’ve tried stuff like


on keystroke command & t
	display dialog "Hi"
end keystroke

unfortunately, that doesn’t work. If anyone knows how to do this, I would be grateful.

thanks