I have a problem with the script. It won't teleport me and I don't know why?

I try to make a matchmaking like in the “Camping” game but it won’t teleport me. I hope you could find the mistake, because I don’t know why it won’t teleport me.

That is the error message:
image

That is the script:
local AssetService = game:GetService(“AssetService”)
local teleportService = game:GetService(“TeleportService”)
local PlaceTemplateId = 3533094000

local config = script.Parent.Configuration

local games = 0

function Countdown()
	for i = 1,6 do
		if config.Countdown.Value == false then
			if script.Parent.Chairs[i].Occupant == nil then
			else
				config.Countdown.Value = true
				break
			end
		end
	end
end

function seat()
	script.Parent.JoinPlate.Touched:Connect(function(hit)
		for i = 1,6 do
			if script.Parent.Chairs[i].Occupant == nil then
				hit.Parent:WaitForChild("HumanoidRootPart").CFrame = script.Parent.Chairs[i].CFrame
				break
			end
			wait(0.0025)
		end
		wait(2)
		Countdown()
	end)
end

function teleport()
	games = games + 1
	local Name = "Spiel : "..games
	local gamePlaceId = AssetService:CreatePlaceAsync(Name ,PlaceTemplateId)
	local players = {}
	for i,sit in pairs(script.Parent.Chairs:GetChildren()) do
		if sit.Occupant == nil then
		else
			local plr = sit.Occupant
			table.insert(players,1,plr.Parent.Name)
		end
		wait(0.0025)
	end
	wait(1)
	for _,player in pairs(players) do
		teleportService:Teleport(gamePlaceId,game.Players[player])
	end
end

config.Countdown.Changed:Connect(function()
	if config.Countdown.Value == true then
		for i = 1,60 do
			script.Parent.Countdown.Gui.Countdown.Text = ""..(60-i)
			if (60-i) == 0 then
				teleport()
			end
			wait(1)
		end
	end
end)

seat()

I hope you could help me!

You’re getting this error because you don’t have the Create Place API enabled. Head over to your place settings, go to the “Games” tab, and tick “Allow this place to be copied as a template using the Create Place API in your game.”

2 Likes

I did turn the Create Place API on but the error comes again!

image

Out of curiosity, I investigated both your PlaceId and your code and I noticed something; it seems like what you’re intending to do is create a server for players to teleport to. Am I not correct? If your intention is to do that, don’t. The CreatePlace API is not meant for that.

If what you seek is to create a server for players in a specific place, you are meant to use reserved servers. This API was specifically created to stop developers from creating new places just to effectively start new servers. Roblox can issue server ids and create them at no cost, while new places are a different ballpark in terms of how they’re handled.

2 Likes

Thank you very much. You did help me a lot. Now I have my own Matchmaking system!