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

How Can I Teleport Players Without Letting Other Players Join Mid-game?

Asked by 3 years ago
Edited 3 years ago

So this is something that I have been trying to figure out for some time. I am making a game that has this party system where you walk into an elevator or something and you are put into a party. Once there is enough people in that party, everyone in that party gets teleported to the game to play. Basically I'm trying to make the party teleporting system like Tower Defense Simulator. I've wrote some scripts myself but all resulting into other people being able to join the server mid-game and in TDS you can't join mid-game like that. So can someone please help me and explain what I need to do because I've been trying to do this for a long time, reading articles and stuff but still not understanding what I really need to do to actually make servers without letting other people join but the party members. So please educate me so that I can continue making my game and that I don't have to keep dying inside for being stupid. Very much appreciative!

local playerList = {}    
local teleportService = game:GetService("TeleportService")
local code = teleportService:ReserveServer(game.PlaceId)

script.Parent.JoinWall.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        for i = 1,#playerList do
                local gameLoadingScreen = game.ReplicatedStorage.GameLoadingScreen:Clone()
                gameLoadingScreen.Parent = playerList[i].PlayerGui
        end
        teleportService:TeleportToPrivateServer(game.PlaceId, code, playerList)
    end
end)

This isn't the whole script, but this is basically the code to teleport the players to the game. I know some things about teleport service, but not enough to figure out how to not let other people join the game mid-game. I hope this helps!

0
Can you give me your script, that would help since scripting helper want you to give out script lamgogo 56 — 3y
0
I updated my post. Now you can see what my script basically looks like for teleporting. bbenry23423Twin 0 — 3y

Answer this question