Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

ReserveServer via chat not working?

After going on the ReserveServer page on the Developer Hub, I decided to tried to recreate what happens in Airplane where people in a specific area get teleported onto a reserved server. But first, I'm trying to make it by chat (It told you how to do it on the ReserveServer Page).

This is what I have so far, but it isn't working.

*Note 1: This is a normal script in Workspace. *Note 2: This is directly copied from the Reserve Server Page except for Lines 8, 9, 10, 18, and 19.

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()
 
-- Get the saved code
local code = DS:GetAsync("ReservedServer")
if type(code) ~= "create" then -- None saved, create one
	print("Yes")
	code = TS:ReserveServer(4066874124)
	DS:SetAsync("ReservedServer",code)
end
 
local function Joined(plr)
	-- Everytime they chat, we want to know
	plr.Chatted:Connect(function(msg)
		if msg == "reserved" then -- Aha, that's our cue
			print("Reserved")
			TS:TeleportToPrivateServer(4066874124,code,{plr})
		end
	end)
end
 
-- Connect all current and future players
Players.PlayerAdded:Connect(Joined)
for k,v in pairs(Players:GetPlayers()) do
	Joined(v)
end

Help is greatly appreciated.

1 answer

Are there any errors?

What's not working?

Please provide more detail.

1 comment

1

If you are not posting an explanation please comment instead.

This discussion is preserved as it was. New answers, comments, and votes are closed.