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
4 years ago
        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

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

1 answer

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

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)
Ad

Answer this question