Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can you teleport all players to a Certain Area?

I have been thinking of this for a long time... How can you teleport all players to a certain area?

No matter how much I try to research, I cant find anything. So I decided to come on this site to ask a question.

1 answer

✓ Accepted answer

Assuming you meant teleport within a place, there is an article made by roblox.

You'll need to get all players first, using game.Players:GetPlayers().

local plrs = game.Players:GetPlayers()

Next, teleport players to the area. We can do this using SetPrimaryPartCFrame.

Player's character have primarypart on itself already, so we can just use that on characters. We'll check if character exists just in case.

Use for loop because we want every player to be teleported.

for index, plr in pairs(plrs) do
    if plr.Character then --check for player character
        plr.Character:SetPrimaryPartCFrame(CFrame.new(0, 0, 0)) --replace the numbers in CFrame with the position you want
    end
end

The code should look like this now:

local plrs = game.Players:GetPlayers()
for index, plr in pairs(plrs) do
    if plr.Character then
        plr.Character:SetPrimaryPartCFrame(CFrame.new(0, 0, 0))
    end
end

1 comment

0

Thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.