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

Teleport the rest?

Asked by 9 years ago

I have this code:

while game.Players.NumPlayers < 1 do
        wait()
    end 
local Players = game.Players:GetPlayers()
local Phantom = Players[math.random(#Players)]
target = Vector3.new(45, 17.5, -27)
Phantom.Character.Torso.CFrame = CFrame.new(target)

That teleports 1 random player? How would i teleport the rest?

else
target = Vector3.new(45, 17.5, -20)
Phantom.Character.Torso.CFrame = CFrame.new(target)

This doesnt work. Please help! Thanks for reading

2 answers

Log in to vote
0
Answered by 9 years ago

create a for loop that loops through all the players and puts them at that position one by one. The Vector 3 part puts every player on top of each other at that spot, you can edit the CFrame value to (i*5,0,0) if you want a row of players. Then, you need to check if the player is the name of the chosen phantom, if it isn't, teleport the player, else teleport the phantom

local Players = game.Players:GetPlayers()
local target = Vector3.new(45, 17.5, -27)

--Pick a phantom
local phantom = game.Players.PlayerName

for _,i in pairs(Players) do
    if not(i.Name == phantom) then
        i.Torso.Position = target * Vector3.new(0,i*5,0)
    else
        --teleport phantom
end
0
yes, thats good, but would also move the phantom ioutragous 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago
while game.Players.NumPlayers < 1 do
        wait()
    end 
local Players = game.Players:GetPlayers()
target = Vector3.new(45, 17.5, -27)
for i,v in pairs(Players) do
    v.Character.Torso.CFrame = CFrame.new(target)
end

Answer this question