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

How Can I Teleport the first players/index of the Tables to A Different place from the Second One?

		local player1 = game.Players:GetPlayers()[1]
		local player2 = game.Players:GetPlayers()[2]
player1.Character.HumanoidRootPart.Position = Vector3.new(-115, 5.5, -97)
player2.Character.HumanoidRootPart.Position = Vector3.new(-148, 0.5, -99)
end
end

This Code Works, it does what I need, but it looks through all the players in game, and not only to the ones that are inside the table

I tried the following code but it didn't work...

local player1 = playingPlayers[1]
local player2 = playingPlayers[2]

playingPlayers is the Table

2 comments

0

The second block of code will do the same as the first if there are PlayerObjects in it.

0

The game.Players:GetPlayers()[1] and the 2 work, but i dont want to look through all players, only through the table as i explained...

1 answer

Someone Helped me with it on discord

The Working Code:

		local player1 = game.Players:FindFirstChild(playingPlayers[1])
		local player2 = game.Players:FindFirstChild(playingPlayers[2])
player1.Character.HumanoidRootPart.Position = Vector3.new(-115, 5.5, -97)
player2.Character.HumanoidRootPart.Position = Vector3.new(-148, 0.5, -99)

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