Action on file type in a folder


I am beginner in AS and Os10.5.6

I wish to make a folder action script
to force set file type in “TEXT”
and set creator type in “ttxt”

on each file submitted by local network clients

I try unsuccessfully with

on open LstDoc
set Err to “”
repeat with Itm in LstDoc
tell application “Finder”
set file type of Itm to “TEXT”
set creator type of Itm to “ttxt”
update Itm
end tell
do shell script "/bin/chmod ugo=rwx " & (quoted form of POSIX path of Itm)
on error
set Err to Err & Itm & return
end try
end repeat
set the clipboard to Err
end open

because the code does not seem suited to folder action script for each “local netwokts clients”
I need some help about this

Thanks and best regards