How to get live group funds count

I need this for making a crowdfunding game thing. Please give me direct instruction with code and stuff.

3 Likes

You have to use HttpService + rprxy + Economy API. Something like

local success, funds = pcall(function()
    local data = HttpService:GetAsync("economy.rprxy.xyz/v1/groups/"..groupId.."/currency")
    local funds = HttpService:JSONDecode(data).robux
    return funds
end)

if success then
-- do something with the funds
end
2 Likes

A small typo fix in your code; you used the arithmetic add (+) operator instead of concatenation (..) operator for combining strings on 2nd line.

2 Likes

So that’s all I need to do???

1 Like

Yes, although I imagine you’d need to mess with the headers otherwise you’d get a response similar to this one. Unfortunately the economy API is not very well documented (if it’s even documented at all).

{"errors":[{"code":3,"message":"Insufficient permissions.","userFacingMessage":"Something went wrong"}]}
1 Like

success is always false when I run this why is that?

1 Like

Try to print funds variable in your code after pcall.

1 Like

Heres the output: economy.rprxy.xyz/v1/groups/8217575/currency: Trust check failed

1 Like

so how can I have an authenticated user

local fundlabel = script.Parent.FundCount
local memberlabel = script.Parent.Parent.GroupMemberFrame.MemberCount

local httpservice = game:GetService("HttpService")

local groupId = 8217575

local AltCookie = "ABCDEF123456ABCDEF123456ABCDEF123456" -- Cookie of account that has access to see the funds

while wait(5) do
	local Success, Response = pcall(function()
		return httpservice:RequestAsync({
			Url = "https://economy.rprxy.xyz/v1/groups/" ..groupId.. "/currency",
			Method = "GET",
			Headers = {
				['Cookie'] = ".ROBLOSECURITY="..AltCookie
			}
		})
	end)

	if Response.Success then
		local Body = httpservice:JSONDecode(Response.Body)
		fundlabel.Text = Body.robux
		memberlabel.Text = Body.memberCount
		print("Member: "..Body.memberCount)
		print("ROBUX: " .. Body.robux)
	else
		warn(Response)
	end
end

Heres the solution for some reason it was deleted :confused:

I don’t know why my post was deleted lol… Here’s the original code

local GroupId = 123456789
local AltCookie = "ABCDEF123456" -- Cookie of account that has access to see the funds

local HttpService = game:GetService'HttpService'
local Success, Response = pcall(function()
	return HttpService:RequestAsync({
		Url = "https://economy.rprxy.xyz/v1/groups/" .. GroupId .. "/currency",
		Method = "GET",
		Headers = {
			['Cookie'] = ".ROBLOSECURITY=" .. AltCookie
		}
	})
end)

if Response.Success then
	local Body = HttpService:JSONDecode(Response.Body)
	print("ROBUX: " .. Body.robux)
else
	warn(Response)
end
3 Likes

Is there an api where I can also give out Group funds trough HttpService?!