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 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.
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)
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)