Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to use TS with tables properly?

Hello, I am trying to make a party teleporter thing. Currently, it puts the player's name into a folder with a String Value. Sadly, I couldn't seem to get it work, any help is appreciated. Here is my current script;

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")

local children = script.Parent.Folder:GetChildren()
for i = 1, #children do
	local child = children[i]
end

TeleportService:TeleportPartyAsync(000000000, children)

1 answer

The second argument of :TeleportPartyAsync() involves the player objects, not their names. You said the objects inside the folder are StringValues, with values of each player's name. The problem is that these are not player objects. To get the player objects, for example, you could run game.Players:GetPlayers(). I assume you do not want to teleport the whole server, though, so you'll have to determine how to get each player's object (since I can't see your whole set-up).

Anyways, here's an example, based on your code:

local Players = game:GetService("Players"):GetPlayers()
local TeleportService = game:GetService("TeleportService")

TeleportService:TeleportPartyAsync(000000000, Players)

This discussion is preserved as it was. New answers, comments, and votes are closed.