Syntax error (On js script)


Hello, I have a syntax error on my code and I’m not sure how to fix it, if you know about web development a response would be nice.

Hey there, this should probably go in scripting support or code review

Thank you for telling me! I have changed it.

1 Like

Link the script and not the image only and describe the issue in detail.

Which line is the syntax error on? I can’t spot any errors just by reading.


  try {

    let userId = e.parameter.userId;

    let groupId = e.parameter.groupId;

    let rank;

    // Make a request to the Roblox API to retrieve the user's rank in the group

    let response = UrlFetchApp.fetch(`https://api.roblox.com/users/${userId}/groups/${groupId}`);

    let data = JSON.parse(response.getContentText());

    rank = data.Role;

    // Return the rank back to the server-side script

    return ContentService.createTextOutput(JSON.stringify({rank: rank})).setMimeType(ContentService.MimeType.JSON);

  } catch (error) {

    console.error(error);

  }

} theres the error on the api link

on the api link where the red line is

Could you mouse over the red line and see if anything pops? It seems like it’s just highlighted because you’re using a formatter string.

The https:// protocol at the beginning of the URL in the UrlFetchApp.fetch() function is probably the source of the error you are encountering.

The UrlFetchApp.fetch() function’s syntax for the URL is as follows:

let response = UrlFetchApp.fetch('https://api.roblox.com/users/' + userId + '/groups/' + groupId);

Keep in mind that the userId and groupId variables are concatenated with the + operator, and the URL text is wrapped in single quotes.

I hope this is useful. If you have any further inquiries, please let me know.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.