How can I get the value of an array?

I’m using @Froast’s ProxyService but I’m stuck at using the data.
The script works, but the value it’s returning is this:

image

As you can see, how would I be able to collect only the Player’s VisitorId and LastOnline data?

Get the VisitorId key inside that array and print it.
print(tostring(table[key]))

I tried that, still returns nil.

You need to use the HttpService:JSONDecode(get) which converts it into a lua table.

Edit: You can find the reference here

I’ve already mentioned that I’m using Froast’s ProxyService. And it looks like JSONDecode is used, but it still returns it as this.

Screenshot_15

If its printing this it doesn’t seem to be using the JSONDecode.

If you compare the API example to your print it doesn’t look like it is.

Screenshot_17

1 Like

I also noticed in one of his examples he has a .body at the end, I don’t know if this applys to what your doing.

1 Like

Since I believe you’re already in the module, what do you think I should change?

Because I can’t think any other way to get the data other than using string manipulation

You can try using the JSONDecode then print and see if it changes what prints out.

1 Like

Unfortunately no, it doesn’t work.

What did it print and can you show the code?

Edit: You want it to print this essentially Screenshot by Lightshot

1 Like

Unfortunately, you’re partially correct. There was some keys missing though, like the GameId and PlaceId.

image

Inconveniently I have to get off,

Try using a for i,v loop and go through the table and print the loop results.

I will try and further assist you when available.

1 Like

They were null/“nil” because the player wasn’t ingame. In Lua, when a key is nil, it’s as though it does not exist in that table, so it won’t show up in a print/for loop.

2 Likes