Okay so I have a script that will create a Reserved Server for a game. Here’s the script:
script.Parent.tpupdater.OnServerEvent:Connect(function(plr, placeid)
script.Parent.tarplace.Value = placeid
local id = 6853540
local pname = game.Players[plr.Name].Name
local player = game.Players[pname]
local MarketplaceService = game:GetService("MarketplaceService")
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, id) then
print("player has gamepass")
script.Parent.ps.MouseButton1Click:Connect(function()
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local code = TS:ReserveServer(placeid) -- Returns a code
local players = {plr} -- Get a list of all players
TS:TeleportToPrivateServer(placeid,code,players) -- Actually teleport the players
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen
end)
else
script.Parent.ps.Text = "This is a Donator Feature!"
end
end)
Thanks for any help!