I figured out a way to make a limited stock work with badges, however this happens

The variable needs to be inside the while true do, not outside. Thanks for your help! I just had to play around with the script in order to achieve this updating thing.

local badgeservice = game:GetService("BadgeService")
local text = workspace.Part.BillboardGui.TextLabel
local maxstock = 3000000
local check = 1
local http = game:GetService("HttpService")

while true do
	local data = http:GetAsync("https://badges.roproxy.com/v1/badges/1597063654359516")
	if data then
		if typeof(data) == "string" then
			data = http:JSONDecode(tostring(data))
		end

		local stock : number = data.statistics.awardedCount
		local actualstock = maxstock - stock
		text.Text = "STOCK: "..actualstock.."/"..maxstock
		if data.statistics.awardedCount >= maxstock then
			text.Text = "Stock Ended!"
		end
	end
	data = http:GetAsync("https://badges.roproxy.com/v1/badges/1597063654359516")
	task.wait(check)
end
1 Like