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

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

Asked by
Borrahh 265 Moderation Voter
5 years ago
1        local player1 = game.Players:GetPlayers()[1]
2        local player2 = game.Players:GetPlayers()[2]
3player1.Character.HumanoidRootPart.Position = Vector3.new(-115, 5.5, -97)
4player2.Character.HumanoidRootPart.Position = Vector3.new(-148, 0.5, -99)
5end
6end

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...

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

playingPlayers is the Table

0
The second block of code will do the same as the first if there are PlayerObjects in it. namespace25 594 — 5y
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... Borrahh 265 — 5y

1 answer

Log in to vote
0
Answered by
Borrahh 265 Moderation Voter
5 years ago

Someone Helped me with it on discord

The Working Code:

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

Answer this question