Mount Drive based on connection with if else statement (applescript)
Your set ping to statement should have the closing quote after the IP address

In general you are missing a number of end statements. Each try should have a corresponding end try, each tell should have an end tell, each if should have an end if.

The try statements should surround the script action, not inside them. So move them before the tell statements. As you are using them without the 'on error' clause, the try statements aren't very useful - but no harm.

The application should be just &quot;Finder&quot;


Here's a briefer example:
try
    set ping to (do shell script &quot;ping -c 2 192.168.1.240&quot;)
    
    if ping contains &quot;64 bytes&quot; then
        try
            tell application &quot;Finder&quot;
                mount volume &quot;smb://192.168.1.240./music&quot;
            end tell
        end try
        display dialog &quot;Mapped Drives to 192.168.1.240 Network.&quot;
        
    else
        try
            tell application &quot;Finder&quot;
                mount volume &quot;smb://192.168.0.240./music&quot;
            end tell
        end try 
        display dialog &quot;Mapped Drives to 192.168.0.240 Network.&quot;
        
    end if
end try