Teleport exception: 400 Bad Request

  1. I am trying to teleport a player to a private server which code is in a datastore.

  2. Getting the code is not a problem but when I try to use it it throws an error:

  3. I turned HTTP service, printed the teleport code, nothing seems to work!

Additional notes: I am teleporting to the same placeId just a private server.

Are you using the TeleportToPrivateServer function of the TeleportService? Not sure this is your issue, but could it be the case that you are providing a string to the placeId argument and/or a number to the reservedServerAccessCode argument?

TeleportService:TeleportToPrivateServer

The placeId argument must be an int64 (number type should be just fine) and reservedServerAccessCode should be a string. Just thinking this might have something to do with the error because you are loading the values from a data store. If you need to convert to either a number or string you can use tonumber() or tostring() respectively.

I do not htink that is the case, here is my code:
TeleportService:TeleportToPrivateServer(game.PlaceId,CodeVersionDS:GetAsync(code),{player})

Can you pull that section where you’re getting the access code out of the function and print and type it? Like:

local accessCode = CodeVersionDS:GetAsync(code)
print(accessCode)
print(type(accessCode))

Lmk what it prints

I printed the code, seems normal still get same error @East98

Fixed!
I used the Private Server Id of the server I wanted to teleport to as the server code.
That was the wrong thing to do.