How do you put a variable in the middle of a pathway? (AppleScript)
You need to put parentheses around:
compName &amp; &quot;:Users:&quot; &amp; userName &amp; &quot;:Pictures:Camera&quot;

Example:
(compName &amp; &quot;:Users:&quot; &amp; userName &amp; &quot;:Pictures:Camera&quot;)

This concatenates everything within the parentheses as the full path, otherwise Finder just sees:
delete (every item of folder compName &amp; &quot;:Users:&quot; &amp; userName &amp; &quot;:Pictures:Camera&quot; whose name contains &quot;.png&quot;)

As:
get every item of folder &quot;Macintosh HD&quot;

Not the entire path.
So, this works:
tell application &quot;System Events&quot;
    set userName to name of current user
    set compName to name of startup disk
end tell

tell application &quot;Finder&quot;
    delete (files of folder (compName &amp; &quot;:Users:&quot; &amp; userName &amp; &quot;:Pictures:Camera&quot;) whose name contains &quot;.png&quot;)
end tell



Instead of relying on System Events to get that information, you can use the path to (folder) convention to ascertain its path, e.g.:
set targetFolder to (path to pictures folder from user domain) &amp; &quot;Camera&quot; as string

tell application &quot;Finder&quot;
    delete (files of folder targetFolder whose name contains &quot;.png&quot;)
end tell

Please take a moment to read the linked document as I believe you'll find it quite informative.
Also note that since you stated code that deletes files in the OP and your code had the potential to delete a folder having a .png extension that every item  has bee changes to files with the exception of the line after &quot;otherwise Finder just sees:&quot; in this answer as that line is part of explaining what the issue is that you are having.