Automating installer

I’m trying to build an installer app to install some applets into specific folders one of which is the applications folder with ditto. When I do the applet gets broken and wont open.

set sourceZip to ((path to me as text) & "Contents:Resources:applet.zip") as string
set userAppsFolder to path to applications folder --from user domain

tell me to do shell script "ditto -x -k " & quoted form of the POSIX path of sourceZip & space & quoted form of the POSIX path of userAppsFolder user name adminUser password adminPassword with administrator privileges