:ReserveServer() BUG

Script :cold_sweat:

local Part = script.Parent
local TpService = game:GetService("TeleportService")
local Access = TpService:ReserveServer(17884687093)
local Players = {}
local Active = true

Part.Touched:Connect(function(Hit)
	if Hit.Name == "HumanoidRootPart" then
		local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
		if Player and Active  then
			Active = false
			table.insert(Players, Player)
			TpService:TeleportToPrivateServer(17884687093, Access, Players)
			Players = {}
			wait(10)
			Active = true
		end
	end
end)

Problem :cold_sweat: :roll_eyes:

When I test this with my alt, my alt was able to join me to “17884687093” (which is a place inside of my game/experience).
The problem doesn’t happen if I teleport to the place with my alt and then teleport to the place with my main on a new server (Joining the game then teleporting after my alt teleports on a brand new server)!! Why?? How do I fix this??
:cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:

put the access code inside the .Touched event

1 Like

Yoo thanks! this solved the problem

I’m very confused. This advice should NOT be used. And it makes no sense that it “fixed” your issue, which was already rather vague in the first place.

Every time you call TeleportService:ReserveServer(PlaceId) it is creating a NEW Reserved server access code. Touched events are notorious for multiple fires and they fire for every part that is touching at that instant, so this is creating a huge amount of Reserved server codes for no reason.

If I understand you correctly, you wish to make a system that SAVES the reserved server code and then teleports you to that server each time.

If so, the Reference code for the API Documentation on TeleportService:ReserveServer() literally shows you how to do so, and join with saying “reserved” in chat.

Code from the API Docs verbatim:

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")

local dataStore = DataStoreService:GetGlobalDataStore()

-- Get the saved code
local code = dataStore:GetAsync("ReservedServer")
if typeof(code) ~= "string" then -- None saved, create one
	code = TeleportService:ReserveServer(game.PlaceId)
	dataStore:SetAsync("ReservedServer", code)
end

local function joined(player)
	player.Chatted:Connect(function(message)
		if message == "reserved" then
			TeleportService:TeleportToPrivateServer(game.PlaceId, code, { player })
		end
	end)
end

Players.PlayerAdded:Connect(joined)

thats why he checks if the part is the humanoidrootpart? which like prevents that from every single part

That entirely blidesides my point, this is a poor solution that will create wasted resources for Roblox every time a player touches that part. Even if it’s once per player, you only need one reserved server, permanently, unless otherwise stated, in this instance.

Your suggestion is still poor, if not wrong, practice, and as such, is considered poor, if not wrong, advice.

sorry that i gave him a >>temporary<< fix to his problem.

if he wants to do your idea idc, heck can remove my solution but no need to be rude about that

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.