Error code 773 " Attempt to teleport to a place that is restricted."

Yo, I was trying to make a teleporting system ( I stole this ), but everything I tried I keep getting error code 773 " Attempt to teleport to a place that is restricted."

Here is my code any help would be appreciated!

local TransitionEvent = game.ReplicatedStorage.TransitionEvent
local TweenService = game:GetService("TweenService")
local TeleportService = game:GetService("TeleportService")
local TeleportID = 14885369639 -- Change to your game ID

local Players = {}
local IsTeleporting = false
local PlayersAllowed = script.Parent.PlayersAllowed
local Truck = workspace:WaitForChild(script.Parent.Parent.Truck.Value)

local Gate = script.Parent.Gate
local Timer

local Frame = Gate.SurfaceGui:WaitForChild("Frame")
local PlayerNumber = Frame:WaitForChild("PlayerNumber")
local TimeNumber = Frame:WaitForChild("TimeNumber")
local ExitEvent = game.ReplicatedStorage.ExitEvent

local TweenService = game:GetService("TweenService")


game.Players.RespawnTime = 0

function Refresh()
	PlayerNumber.Text = #Players
end


local function RemoveFromList(Char)
	for i = 1,#Players do
		if Players[i] == Char.Name then
			table.remove(Players, i)
			Char.Humanoid.JumpPower = 50
			Refresh()
		end
	end
end

local function Teleport()
	if #Players > 0 then
		local TeleportPlayers = {}

		for i = 1, #Players do
			if game.Players:FindFirstChild(Players[i]) then
				table.insert(TeleportPlayers, game.Players:FindFirstChild(Players[i]))
				TransitionEvent:FireClient(game.Players:FindFirstChild(Players[i]))
			else
				table.remove(Players, i)
			end
		end
		
		
		local Code = TeleportService:ReserveServer(TeleportID)
		
		
		IsTeleporting = true
		TeleportService:TeleportToPrivateServer(TeleportID, Code, TeleportPlayers)
		
		repeat wait() until #Players <= 0
		
		IsTeleporting = false
	end
end


Gate.Touched:Connect(function(Hit)
	if Hit and Hit.Parent:FindFirstChild("Humanoid") then
		if IsTeleporting == false then
			local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
			local Character = Player.Character or Player.CharacterAdded:Wait()
			local InsideGate = false
			
			for i = 1, #Players do
				if Players[i] == Character.Name then
					InsideGate = true
				end
			end
			
			local Truck = workspace:WaitForChild(script.Parent.Parent.Truck.Value)

			
			if InsideGate == false and #Players < PlayersAllowed.Value then
				table.insert(Players, Character.Name)
				local ResponsdingSeat = Truck:WaitForChild("Seat"..#Players)
				Character:WaitForChild("HumanoidRootPart").CFrame = ResponsdingSeat.CFrame
				Character.Humanoid.JumpPower = 0
				Refresh()
				ExitEvent:FireClient(Player)
			end
			
			Player.CharacterRemoving:Connect(function(Char)
				RemoveFromList(Char)
			end)
			
			
			
			Character.Humanoid.Died:Connect(function()
				RemoveFromList(Character)
			end)
			
			if #Players == PlayersAllowed.Value then
				Teleport()
			end
			
		end	
	end
end)

ExitEvent.OnServerEvent:Connect(function(player)
	if player.Character then
		player.Character.Humanoid.Health = 0
		RemoveFromList(player.Character)
	end
end)

while wait() do
	Timer = 25
	
	for i = 1, Timer do
		Timer = Timer - 1
		TimeNumber.Text = Timer
		wait(1)
	end
	Teleport()
end```

The place you’re teleporting to (The Horse Story [NEW] - Roblox) isn’t owned by you, therefore you can’t teleport to it.

You can only teleport to places in the same Roblox Universe as yours.

Yeah, so it’s in another game for another person, how would I fix this?

The game is ownerd by another person who’s game I’m on but I can’t teleport to the place? Will making the script being created by them fix something?

Yes, as long as they own both the to and from game. Do your testing on your games.
Not sure if setting Collaborate would help here, I would think so.