#I am trying to get the groups a player is in and then send it in a message with the names

1 messages · Page 1 of 1 (latest)

winged hatch
#

provide code

#

the object is most likely the group
it's like
class Group()
u can print it to see it's attributes

#

not sure why u would get an Object when u should probably be getting a json like all the normal apis

winged hatch
#

is that js

#

not entirely sure what ${} is

#

cant help ya then

#

ye but idk what param .setDescription takes

#

so consider reading the docs

#

for whatever package that is

#

cuz it could be asking for an id

#

not an object

severe bolt
#

Why do you have an issue with it returning an object?

lunar glade
#

you’re trying to turn the object into a string

#

i’m not really sure what the whole goal of your code is could you clarify that?

winged hatch
#
  1. Cant figure out the goal ✅
  2. Cant figure out the issue ✅
#

i'm assuming he wants to get the groups names and print em

#

which would require a for loop over the groups... then simply calling the Name attribute

#

is a good start

severe bolt
#

What do you mean its not the groups?

#

What does it return if not the group stuff.

#

From the title it seems like this is what you should be using.

#

Which returns a promise of an array containing the groups a user is in.

winged hatch
#

he seems to be using it right

severe bolt
#

Like it should return this info

severe bolt
#

Where they can just get the name.

severe bolt
winged hatch
#

ye he wants to print all the names

#

which i'm guessing he doesn't know how to loop over the groups

#

and print the names

severe bolt
#

Very likely,

winged hatch
#

@severe bolt idk if u know js

#

but is it possible to get all the names in a list

#

without a loop?

#

like a built-in function of some sorts?

#

i know it doesn't exist in luau

severe bolt
#

I don't completely know but I don't think so.

#

I normally just do a loop.

#

When I want to get info from an array.

winged hatch
#

hmm

#

hm i guess ill make the function myself

#

:T

severe bolt
#

Somthing I quickly made up which should work. Dunno if its the best.

async function SendRequestGetGroups() {
  noblox.getGroups(1471902232).then(groupData => {
    groupData.forEach(group => {
      console.log(group.Name)
    })
  }).catch(err => {
    console.log(err)
  })
}

SendRequestGetGroups()```
#

Can't remember how to format the code correctly in Discord ytskull

winged hatch
#

add

#

js

#

after the first 3 openers

#
async function SendRequestGetGroups() {
  noblox.getGroups(1471902232).then(groupData => {
    groupData.forEach(group => {
      console.log(group.Name)
    })
  }).catch(err => {
    console.log(err)
  })
}

SendRequestGetGroups()
#

bam

#

i hate js tbh

#

it looks so bad ;T

severe bolt
#

with js in the text

winged hatch
#

js doesnt go

#

in that line

#

before that line

#

with the openers

severe bolt
#

Ah

#

Thats better

winged hatch
#

ye

severe bolt
#

Its been a long time since I have wrote code on Discord

winged hatch
#

👍

severe bolt
#

(the stuff my code logs is the group names)