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

How do I teleport all players except me to a part?

Asked by 4 years ago
Edited 4 years ago

Hey guys, I'm trying to teleport every player to a part but NOT me but idk how to. Heres what I have:

while wait() do

for _, player in pairs(game.Players:GetPlayers()) do player.Character.HumanoidRootPart.CFrame = game.Workspace.kah.CFrame end end

So this teleports all players including me to a part thats named kah. But I want it to teleport all OTHER players. NOT me.

If you can help, thanks!

0
why did u put your code in a Quote? Luka_Gaming07 534 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

What to do?

  1. Check if the Players UserId is Your UserId
    • I say UserId cause if you change your username it will still work
  2. If the UserId is not your UserId then teleport

Final Script

I'm not giving you any script because i want you to learn how to script. If i just gave you a script you are not going to learn from it.

Also, Why did u put your script inside a quote like this?

-- It should be like this
Ad
Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
4 years ago

This should work (another way to do it)

while wait() do

for _, plr in pairs(game.Players:GetChildren()) do
    local char = plr.Character
    if char.Name ~= "BiIIyMarchiafava" then
        char:MoveTo(game.Workspace.kah.Position)
    end
end
end

Answer this question