So I'm trying to get the amount of players playing a certain game but my script appears to show "undefined" when I try to use the API. Here is my script.

var Discord = require('discord.js')
const fetch = require('node-fetch')
const url = 'https://games.roblox.com/v1/games/1213026131/servers/Public?sortOrder=Asc&limit=10'

module.exports = {
    name: "Player",
    description: ". . .",
    async execute(message, msg) {

        let response = await fetch(url);
        let Data = await response.json();

        const embed = new Discord.MessageEmbed()
            .setTitle('Data')
            .setDescription(Data.playing)
            .setColor('#00ff00')
            .setFooter('NotAxIr')

            message.channel.send(embed)
    }
}

3 comments

0

ur script has far too many errors

0

let isn't a function as well as const, var. async isn't defined

0

How would I fix this?