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

How to teleport All players into certain bricks?

Asked by 10 years ago

Ive been doing a Sf game and I need someone to help me ive tried it before but it dosent work can you help me?

0
Define exactly what you want/need to do. There's not enough information here. hiccup111 231 — 10y
1
I need to teleport all players into specific bricks. digitalzer3 123 — 10y

1 answer

Log in to vote
1
Answered by
Ekkoh 635 Moderation Voter
10 years ago

If you're wondering about teleporting players, this is one common method.

Player.Character.Torso.CFrame = CFrame.new(x, y, z)
-- where x, y, z is the coordinates of the position you want to teleport the player to

If you want to teleport each player to a given position, you'd need to iterate through the player list and teleport each one.

for _, plr in pairs(Game:GetService("Players"):GetPlayers()) do
    if plr.Character then -- just a precaution to make sure the player is spawned
        plr.Character:FindFirstChild("Torso").CFrame = CFrame.new(0, 0, 0)
    end
end

If you wanted to, you could make your own function for it.

function teleport(plr, x, y, z)
    if plr.Character then
        plr.Character:FindFirstChild("Torso").CFrame = CFrame.new(x, y, z)
    end
end
teleport(Game.Players.Ekkoh, 30, 5, 103)
-- would teleport me to (30, 5, 103)
Ad

Answer this question