directory path as an input from the user

I wrote the following code in order to enable the user to choose a diectory and get the directory path as an input, but apperantely it doesn’t work.
any suggestions?

on clicked theObject

tell application "Finder"
	activate
	set target of Finder window 1 to disk "disk_name"
	set position of Finder window 1 to {569, 357}
	set my_folder to the name of target of Finder window 1
	
end tell

set contents of text field "folder_name" to my_folder

end clicked

well, I found the answer to my problem:

on clicked theObject

set can choose directories of open panel to true

set can choose files of open panel to false

display open panel attached to window "TitlesScript"

end clicked

on panel ended theObject with result withResult

if withResult is 1 then
	
	set theFolder to item 1 of (path names of open panel as list)
	set contents of text field "folder_name" of window "TitlesScript" to theFolder
	
end if

end panel ended