Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

API for player count not working?

Asked by 3 years ago

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)
    }
}
0
ur script has far too many errors JesseSong 3916 — 3y
0
let isn't a function as well as const, var. async isn't defined JesseSong 3916 — 3y
0
How would I fix this? NotAxIr 0 — 3y

Answer this question