Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a ReserveServer?

Asked by 4 years ago
Edited 4 years ago

I've looked in the documentation and tested the chatting code:

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) ~= "string" then -- None saved, create one
    code = TS:ReserveServer(game.PlaceId)
    DS:SetAsync("ReservedServer",code)
end

local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0

print(isReserved)

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
            TS:TeleportToPrivateServer(game.PlaceId,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

Whenever the game tries to make a new server it says HTTP 403 (Forbidden) Does anyone know how to fix this???

0
Have you enabled HTTP services and API services? Dovydas1118 1495 — 4y
0
Yes I just realized that I forgot to enable HTTP services ??????? me CCjump21 0 — 4y

Answer this question