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

Attempting to get a Players limited value from Rolimons?

Asked by
VAHMPIN 277 Moderation Voter
3 years ago
Edited 3 years ago

Hey, so i was trying to get a players limited value, which i could then transfer into values of other plays using a join event.

However, it always returns NIL when trying to use %d+ to match the number (it has a comma in it when its extra numbers like 1,567)

The Code i'm using is:

local HTTP = game:GetService("HttpService") 
local Link = HTTP:GetAsync("https://www.rolimons.com/player/1689463945")
local GetValue = Link:match'id="player_value">(. %d+)' -- yes i removed the . from inside before

print(GetValue)

If you want to see the HTML yourself: https://imgur.com/78rKxeZ

Any help with this would be appreciated!

1 answer

Log in to vote
0
Answered by
gskw 1046 Moderation Voter
3 years ago
Edited 3 years ago

%d+ doesn't match commas, and the code has a dot+space pattern that doesn't match the HTML. The correct way would be like so:

local GetValue = Link:match'id="player_value">([0-9,]+)<' -- Match digits and the comma
GetValue = GetValue:gsub(",", "") -- Remove commas from it
0
Will test now. Hopefully it'll work. VAHMPIN 277 — 3y
0
I was getting an error with gsub, since it's not able to be JSON Decoded, i removed the gsub and still got nil (no numbers) https://imgur.com/LjAWFZe maybe i need to convert it somehow? Not sure - it returns nil but the image didnt capture it VAHMPIN 277 — 3y
1
Ah, this is because the original HTML doesn't contain the value (it says &nbsp; instead). It's only dynamically fetched. I'll update my answer shortly. gskw 1046 — 3y
0
Alright, thanks. VAHMPIN 277 — 3y
View all comments (2 more)
0
Uh, I took a look at Rolimon's JavaScript, and it seems a bit too heavy for me to reverse engineer it right now. You might want to try it for yourself though. Search for "item_list" and "calculate_player_stats_from_assets" in player2.js. gskw 1046 — 3y
0
Alright, thanks, i'll keep this open until i figure it out though! VAHMPIN 277 — 3y
Ad

Answer this question