Hello! I’m making direct connect to my game however i get error that place is restricted despite fact should’t be:
[Alpha] is game menu > Legacy is game im trying to join
I’m trying to connect using job id (teleport for admin)
Code
local text = script.Parent.TextBox.Text
-- 5167224097
function hit()
text = script.Parent.TextBox.Text
game:GetService("TeleportService"):TeleportToPlaceInstance(5167224097, text, player)
end
script.Parent.TextButton.MouseButton1Click:Connect(hit)
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
-- Is this player following anyone?
local followId = player.FollowUserId
-- If so, find out where they are
if followId and followId ~= 0 then
local success, errorMessage, placeId, jobId = pcall(function()
return TeleportService:GetPlayerPlaceInstanceAsync(followId)
end)
if success then
-- Teleport player
TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
end
else
warn("Player " .. player.UserId .. " is not following another player!")
end
end)
This is what the DevHub says to do. Be sure you’re writing the correct code.
I would first like to emphasize @astra_wr 's response seeming as he is right that the JobId should look like that.
However two requirements to make sure of:
the server which has the JobId is actively running, if the server closes the place automatically becomes restricted. To test this you would need a friend in the server which needs help.
you cannot teleport to a sub place of a universe unless you are in the universe already - in other words it will not work if the place your teleporting from is not a sub place of the universe.