HttpService is not allowed to access ROBLOX resources

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Make a rng system for roblox games

  2. What is the issue? Geting the HttpService is not allowed to access ROBLOX resources error

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I saw if i put the http option off and the dev hub didn’t work out.

I am trying to make a rng system where you rolls games and is randomised games that start from 10k visits to 1 billion visits. Each game is placed on eaxh rarity depending on the popularity of the game. We have an error saying HttpService is not allowed to access ROBLOX resources.
Here is the script:

local button = script.Parent
local rollsContainer = button.Parent
local resultLabel = rollsContainer:FindFirstChild("ResultLabel")


print("Button:", button)
print("RollsContainer:", rollsContainer)
print("ResultLabel:", resultLabel)

if not resultLabel then
    warn("ResultLabel not found in RollsContainer.")
end

local getPopularGames = game:GetService("ReplicatedStorage"):WaitForChild("GetPopularGames")


local rarities = {
    {name = "Supercalifragilisticexpialidocious", color = Color3.new(1, 1, 1), chance = 1/999999999999},
    {name = "Infinite", color = Color3.fromRGB(105, 105, 105), chance = 1/100000000000},
    {name = "Zephyrous", color = Color3.fromRGB(0, 0, 0), chance = 1/10000000000},
    {name = "Quintessential", color = Color3.fromRGB(255, 165, 0), chance = 1/1000000000},
    {name = "Unimpeachable", color = Color3.fromRGB(160, 82, 45), chance = 1/100000000},
    {name = "Astronomical", color = Color3.fromRGB(0, 127, 255), chance = 1/10000000},
    {name = "Surreptitious", color = Color3.fromRGB(220, 20, 60), chance = 1/2000000},
    {name = "Translucent", color = Color3.fromRGB(255, 191, 0), chance = 1/999999},
    {name = "Vortex", color = Color3.fromRGB(128, 0, 0), chance = 1/666666},
    {name = "Supernatural", color = Color3.fromRGB(152, 255, 152), chance = 1/500000},
    {name = "Enchanted", color = Color3.fromRGB(80, 200, 120), chance = 1/250000},
    {name = "Immemorial", color = Color3.fromRGB(224, 17, 95), chance = 1/99999},
    {name = "Unparalleled", color = Color3.fromRGB(255, 127, 80), chance = 1/50000},
    {name = "Phenomenal", color = Color3.fromRGB(230, 230, 250), chance = 1/10000},
    {name = "Mythic", color = Color3.fromRGB(255, 0, 255), chance = 1/7500},
    {name = "Majestic", color = Color3.fromRGB(75, 0, 130), chance = 1/5000},
    {name = "Obscure", color = Color3.fromRGB(0, 0, 128), chance = 1/2000},
    {name = "Charmed", color = Color3.fromRGB(0, 255, 255), chance = 1/1000},
    {name = "Surreal", color = Color3.fromRGB(250, 128, 114), chance = 1/500},
    {name = "Legendary", color = Color3.fromRGB(255, 215, 0), chance = 1/333},
    {name = "Divine", color = Color3.fromRGB(255, 255, 224), chance = 1/250},
    {name = "Marvellous", color = Color3.fromRGB(255, 105, 180), chance = 1/100},
    {name = "Thrilling", color = Color3.fromRGB(128, 128, 128), chance = 1/60},
    {name = "Unique", color = Color3.fromRGB(137, 207, 240), chance = 1/40},
    {name = "Epic", color = Color3.fromRGB(255, 255, 0), chance = 1/25},
    {name = "Rare", color = Color3.fromRGB(0, 255, 0), chance = 1/10},
    {name = "Uncommon", color = Color3.fromRGB(0, 0, 0), chance = 1/4},
    {name = "Common", color = Color3.fromRGB(255, 255, 255), chance = 1/2}
}

local function getRarity()
    local roll = math.random()
    local cumulativeChance = 0

    for _, rarity in ipairs(rarities) do
        cumulativeChance = cumulativeChance + rarity.chance
        if roll <= cumulativeChance then
            return rarity
        end
    end

    return rarities[#rarities]
end

button.MouseButton1Click:Connect(function()
    local popularGames = getPopularGames:InvokeServer()
    if #popularGames > 0 then
        local randomGame = popularGames[math.random(#popularGames)]
        local rarity = getRarity()
        resultLabel.Text = "Game: " .. randomGame.name .. " | Rarity: " .. rarity.name
        resultLabel.TextColor3 = rarity.color
    else
        resultLabel.Text = "No games found with over 10,000 visits."
    end
end)

You are not allowed to make roblox api calls directly from scripts, you need to send requests through a proxy like roproxy

Ohh ok, so how would i do that?

can you send the code where you are making the api calls?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")

-- Mock data for popular games
local popularGames = {
	{name = "Adopt Me!", visits = 30000000},
	{name = "Brookhaven", visits = 25000000},
	{name = "Tower of Hell", visits = 20000000},
	{name = "Bloxburg", visits = 15000000},
	{name = "Arsenal", visits = 10000000}
}

-- Create the RemoteFunction if it doesn't exist
if not ReplicatedStorage:FindFirstChild("GetPopularGames") then
	local getPopularGames = Instance.new("RemoteFunction")
	getPopularGames.Name = "GetPopularGames"
	getPopularGames.Parent = ReplicatedStorage
end

-- Function to get popular games
local function getPopularGames()
	-- You can filter popularGames if needed, but for now, we return the mock data
	return popularGames
end

I think some of the script got deleted but It was this

Change any urls you have that are trying to use roblox.com to roproxy.com :grinning:

1 Like