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

How to teleport a group of player standing on a platform using countdown timer?

Asked by 4 years ago
Edited 4 years ago

I've learned you have to use reserveserver. What I really want to know is after a countdown of for an example 30 seconds, is to teleport whoever is standing on a platform to a private server. After teleporting, for the countdown to restart. (BASICALLY the script going into a loop)

[Have to be a minimum of 2 players standing on the platform]

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

like this

local platform = workspace.platform --platform they stand on;
local TeleportService = game:GetService("TeleportService");
local MINIMUM_PLAYERS = 2


while wait() do
    touching = platform:GetTouchingParts();
    local players = {};

    for _, part in pairs(touching) do
        local player = game.Players:GetPlayerFromCharacter(part.Parent) 
        if(player)then
            players[#players + 1] = player
        end
        wait();
    end

    if(#players >= MINIMUM_PLAYERS) then
        for i = 10, -1, 1 do
            print("Teleporting in ", i)
            wait(1)
        end

        TeleportService :TeleportToPrivateServer(place_id, server_code_from_ReserveServer(), players)
    end
end
Ad

Answer this question