For i, v in pairs(game.Players:GetPlayers()) only works for one person

There is always one thing in the map folder, and I am trying to teleport every player that has their name tag inside of a folder.

1 Like

This changed a few years ago, so pcall is identical to ypcall. Here’s a post from 2014:

But yes, please avoid pcall/ypcall in code that you as a developer actually write, they should be reserved for API calls that could error (like when using HttpService or DataStores); Not getting error messages from your own code is extremely confusing during development. If someone needs to safely wrap/spawn a thread without silencing errors you can find a few references to implementations in this post:

I never use a wait in a for loop when iterating through the players in a game. If you do this and have 20 players it will take 20 seconds before it completed the loop for the final player. Instead, end the loop, then wait, then do another for loop if needed. This way it will not conflict with other things in other scripts that will cause bugs depending on your player count.

@Eternalove_fan32
You don’t just use ipairs because it returns an array, it does not at all do that.
Keeping it short, using ipairs is what’s suggested due to how it works and it currently being the fastest generator, not to mention breaking the ‘loop’ on nil being encountered.

1 Like