local TPS = game:GetService("TeleportService")
local debounce = false
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
local plr
if hum then
plr = game.Players:GetPlayerFromCharacter(hum.Parent)
end
if plr then
if debounce == false then
debounce = true
local code = TPS:ReserveServer(3934008719)
print(code)
TPS:TeleportToPrivateServer(1329347510,code,{plr})
wait(1)
debounce = false
end
end
end)
I’m pretty sure the Ids have to be the same. Examine this sample code from the Hub:
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local code = TS:ReserveServer(game.PlaceId) -- Returns a code
local players = Players:GetPlayers() -- Get a list of all players
TS:TeleportToPrivateServer(game.PlaceId,code,players) -- Actually teleport the players
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen
Also, please consider reading the API reference for this.
Hmm, can’t see to figure this out. I tried your script in my game, edited it, it just gets stuck on Line 13 (the ReserveServer line). Sorry that I couldn’t help!