HTTP 403 Problem

Hi, I’ve been making a tutorial in my game, where a player accepts a notification on my custom-made module and gets teleported to a private server. However, there is a mistake when reserving the private server (on the server-side) and an error pops up saying HTTP 403.

local badgeServ = game:GetService("BadgeService")
local repS = game:GetService("ReplicatedStorage")
local teleportServ = game:GetService("TeleportService")
local tutorialRE = repS.TutorialRE

players.PlayerAdded:Connect(function(player)
    if not player or not badgeServ:UserHasBadgeAsync(player.UserId,284254284395404) then return end
    badgeServ:AwardBadge(player.UserId, 284254284395404)
    local reservedServ = teleportServ:ReserveServer(101544465878056)
    tutorialRE:FireClient(player, reservedServ)
end)```

I forgot to show the error:
image

I don’t see anything inherently wrong, try to debug by adding print statements and pcall() around the badge awarding and the reserve server parts of the script.

can you show which line is line 10

is it because third party teleports are blocked (in game settings)

also check the badge number and place ids are correct

Try this way of doing it.
It should print any errors you get, in a better way.

Code
local BadgeService = game:GetService("BadgeService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local tutorialRE = ReplicatedStorage:WaitForChild("TutorialRE")
local badgeId = 284254284395404
local destinationPlaceId = 123456789

Players.PlayerAdded:Connect(function(player)
    if not player then return end

    local hasBadge
    pcall(function()
        hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeId)
    end)

    if not hasBadge then
        print("Player does not have the required badge or check failed.")
        return
    end

    pcall(function()
        BadgeService:AwardBadge(player.UserId, badgeId)
    end)

    local success, reservedServerCode = pcall(function()
        return TeleportService:ReserveServer(destinationPlaceId)
    end)

    if success and reservedServerCode then
        tutorialRE:FireClient(player, reservedServerCode)
    else
        warn("Failed to reserve private server for teleportation.")
    end
end)

I’ll wrap the reserved code in a pcall and see what happens. I don’t need to call the badge awarding since that’s not erroring.

Both of them are correct.
Line 10 is local reservedServ = teleportServ:ReserveServer(101544465878056)

I attempted it and reservedServ returned nil.

local badgeServ = game:GetService("BadgeService")
local repS = game:GetService("ReplicatedStorage")
local teleportServ = game:GetService("TeleportService")
local tutorialRE = repS.TutorialRE

players.PlayerAdded:Connect(function(player)
    if not player or not badgeServ:UserHasBadgeAsync(player.UserId,284254284395404) then return end
    badgeServ:AwardBadge(player.UserId, 284254284395404)
    local reservedServ
    pcall(function()
        reservedServ = teleportServ:ReserveServer(101544465878056)
    end)
    tutorialRE:FireClient(player, reservedServ)
end)

I’ll add it an assert() to debug it

Nevermind, I added a pcall so adding an assert() is just disabling it.