Okay I think someone didn’t my want
I need to check if that is first player then tp that plr to pos1 if that is second plr then tp to pos2
issue is this part of my script
function ImHere(Count)
print(Count)
for i,v in pairs(game.Players:GetChildren()) do
print(i)
if i == 1 then
print("Lets go1")
v.PlayerGui.ReadyUp.Enabled = false
v.Character.HumanoidRootPart.Position = pos1
end
if i == 2 then
print("Lets go2")
v.PlayerGui.ReadyUp.Enabled = false
v.Character.HumanoidRootPart.Position = pos2
end
if i == 3 then
print("Lets go3")
v.PlayerGui.ReadyUp.Enabled = false
v.Character.HumanoidRootPart.Position = pos2
end
end
end
What are you trying to index? The service? It doesn’t go through the if check because the name’s “Players”, you’re checking if the name is “1”. If you want to know how many players there are, #game.Players:GetPlayers() does that.
Therefore, create a variable that determines the amount of players (as stated above), and in your loop, check the number provided by the variable.
Pairs are for dictionaries, ipairs are for arrays. When you use game.Players:GetChildren(), it returns an array of players for v and their index for i.
function ImHere()
for i,v in ipairs(game.Players:GetChildren()) do
if i == 1 then
v.Character.HumanoidRootPart.Position = pos1
else
if i == 2 then
v.Character.HumanoidRootPart.Position = pos2
else
if i == 3 then
v.Character.HumanoidRootPart.Position = pos2
end
end
end
end
end