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

How come this match to HTML didn't work?

Asked by 8 years ago

I found this old question that Ayonjun answered, and it had this neat function that got the amount of people in a group using HTTPService and GetAsync. I tried to do this, but instead with the group owner. It returned a nil value...

function getGroupOwner(groupId) -- returns the group size
    local groupLink = "http://www.rproxy.pw/My/Groups.aspx?gid=" .. groupId
    local html = game:GetService("HttpService"):GetAsync(groupLink, true)
    pattern = [[Owned By: <a style="font-style: italic;" href="../user.aspx?id=%d+"]]
    local ownerName = html:match(pattern):gmatch("%d+")
    return ownerName
end

1 answer

Log in to vote
2
Answered by
funyun 958 Moderation Voter
8 years ago

Why HttpService? Keep things simple, use GroupService.

groupstuff = game:GetService("GroupService"):GetGroupInfoAsync(372) --Get a table of the group info

function RecursivePairs(t) -- I did this because there's tables within the group info.
    for key, value in pairs(t) do
        if type(value) == "table" then
            RecursivePairs(value)
        else
            print(key..":\n\n"..value.."\n")
        end
    end
end

RecursivePairs(groupstuff)
Ad

Answer this question