Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Teleport Service via JobID?

I'm trying to program the ability for players to be able to teleport to their friends, but have gotten every error I could possibly receive. Breaking it down to its bare bones...

script.Parent.MouseButton1Down:connect(function() local Success, Error, placeId, instanceId = game:GetService("TeleportService"):GetPlayerPlaceInstanceAsync(xxxxx) if Success then game:GetService("TeleportService"):TeleportToPlaceInstance(placeId,instanceId) end end)

I replaced the user's ID with xxxxx but I've basically been testing this with myself and a friend trying to teleport to him in the same game from different servers. However, the most common error I am seeing is an HTTP 403 Forbidden error. What is wrong with the code?

1 answer

There are two things you should know about GetPlayerPlaceInstanceAsync.

  1. It can only be called from a Server Script.

  2. It can only check if the player is in the same universe (ex You can't see if he is in Work At A Pizza Place from your game).

With these in mind, I recommend using RemoteEvents to set up your script. Have the LocalScript fire the server and have the server return the success, and the placeId.

I'm not going to do the scripts for you, but I will provide some useful links for you to get started.

TeleportService and GetPlayerPlaceInstanceAsync

1 comment

0

I have used server scripts to do it, but gotten the same error. That is not my issue, my issue is the error that comes up(being the HTTP error). Even when I manually used a name in a server script, I still got an error. Can you tell me if there is something wrong with my code? I know that from a server I just add a parameter (placeId,instanceId,game.Players.SomeName)

This discussion is preserved as it was. New answers, comments, and votes are closed.