ReserveServer via chat not working?
Asked by
5 years ago Edited 5 years ago
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.
01 | local TS = game:GetService( "TeleportService" ) |
02 | local Players = game:GetService( "Players" ) |
03 | local DSS = game:GetService( "DataStoreService" ) |
04 | local DS = DSS:GetGlobalDataStore() |
07 | local code = DS:GetAsync( "ReservedServer" ) |
08 | if type (code) ~ = "create" then |
10 | code = TS:ReserveServer( 4066874124 ) |
11 | DS:SetAsync( "ReservedServer" ,code) |
14 | local function Joined(plr) |
16 | plr.Chatted:Connect( function (msg) |
17 | if msg = = "reserved" then |
19 | TS:TeleportToPrivateServer( 4066874124 ,code, { plr } ) |
25 | Players.PlayerAdded:Connect(Joined) |
26 | for k,v in pairs (Players:GetPlayers()) do |
Help is greatly appreciated.