Teleportation Failure

Hey so i am making a script to allow players to invite their friends to a party from more than one server. The script runs perfectly fine but i get the error “Cannot teleport to a place that is restricted Code 773” when i know for sure it’s public and accessible. Please help!

local success,err = pcall(function()
    SubscribeConnection = MessagingService:SubscribeAsync(InvitesTopic,function(message)
        print(message.Data)
        for _,v in pairs(game.Players:GetPlayers()) do
            if (v.UserId) == tonumber(message.Data.UserID) then
                local GUIToPrompt = v.PlayerGui:WaitForChild("Invite")
                GUIToPrompt.Enabled = true
                GUIToPrompt.Frame.Description.Text = message.Data.Inviter.." has invited you to join their room. If you accept, you will be teleported to their server."
                GUIToPrompt.Frame.PlaceID.Value = tonumber(message.Data.PlaceID)
                GUIToPrompt.Frame.JobID.Value = tonumber(message.Data.JobID)
                GUIToPrompt.Frame.Accept.MouseButton1Click:Connect(function()
                    local TPData = {
                        ["InviterName"] = message.Data.Inviter,
                        ["InviterID"] = message.Data.InviterID
                    }
                    TS:TeleportToPlaceInstance(GUIToPrompt.Frame.PlaceID.Value,GUIToPrompt.Frame.JobID.Value,v,v.Name,TPData)
                    warn("Teleporting"..v.Name.."...")
                end)
                GUIToPrompt.Frame.Decline.MouseButton1Click:Connect(function()
                    GUIToPrompt.Enabled = false
                end)
                break
            end
        end
    end)
end)

SendInviteEvent.OnServerEvent:Connect(function(plr,UserIdToFind)
	local Userfound = false
	local success,err = pcall(function()
		for _,v in pairs(game.Players:GetPlayers()) do
			if v.UserId == UserIdToFind then
				Userfound = v
				break
			end
		end
	end)
	if Userfound ~= false then
		print("In server")
	else
		local Data = {
			["UserID"] = tostring(UserIdToFind),
			["JobID"] = tostring(game.JobId),
			["PlaceID"] = tostring(game.PlaceId),
			["Inviter"] = plr.Name,
			["InviterID"] = tostring(plr.UserId)
		}
		MessagingService:PublishAsync(InvitesTopic,Data)
	end
	
end)
1 Like

If you are testing this in studio, then it will not work. You must do it in an actual instance of Roblox.

1 Like

Hey Grayseon, thanks for your response. I was actually testing on ROBLOX with 3 other people to make sure it wasn’t something on my end so i’m still not sure what’s wrong. Any idea?

What is the place you are trying to teleport to? There is a possibility that the place you are trying to teleport to is restricted to people that aren’t in a group, or a certain role. If you made this game, make sure that the game is public, or you allowed for the other players to have access to the place.

1 Like

The game isn’t currently under a group and I received this error as well even though I own the game.

Could you send me to the link to the game please?

1 Like

Alright. But it will be difficult to test because to replicate the issue you need to have a friend in the same game in a different server within it. TPS Concepting - Roblox

Add in the warn statement the placeid. It should be:

warn("Teleporting"..v.Name.."..."..GUIToPrompt.Frame.PlaceID.Value)

If it is not right, there’s your problem.

1 Like