Applescript : Only run the script if specific input is entered
First, you're trying to check against text returned of y, where y is text returned of x – a string, not a dialog result so text returned of y won't work. Just use y.

Second, you need to be testing your string stored in y against another string, not a number. Wrap 3232 in quotes:

set x to display dialog "What is your password?" default answer "" with hidden answer
set y to (text returned of x)


display dialog (text returned of x)
display dialog y

if y is "3232" then
  display dialog "Hi" buttons ["OK"]
end if