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

Teleporting all players (Easy?) to a Parts CFrame

Asked by 5 years ago

I want this script to Teleport all players to a part ('Spawner') which is located in Workspace, but this script goes by x,y,z CFrame, and i want this ('Spawner') CFrame, example of what i want is like,

local LPlr = game.Players.LocalPlayer
Lplr.Character.HumanoidRootPart.CFrame = game.Workspace.Spawner.CFrame

But, instead of my player i want to make this script to teleport everyone there, instead of (0,50,0) I want the ('Spawner') CFrame.

function teleAll(x, y, z)
        local pos = Vector3.new(x, y, z)
        for _, plr in pairs(game:GetService("Players"):GetPlayers()) do
            if plr.Character then
                plr.Character:MoveTo(pos)
     teleAll(0, 50, 0)

Note: The script does work.

A simple way of saying this is, I want all players teleported to a brick called Spawner in workspace.

2 answers

Log in to vote
0
Answered by
NotedAPI 810 Moderation Voter
5 years ago

Hello, killerbrasko2002!

This script I made was made in this editor so if it's messy my apologies.

for i,v in pairs(game.Players:GetPlayers()) do
    workspace:WaitForChild(v.Name).HumanoidRootPart.CFrame = workspace:WaitForChild("Spawner").CFrame
end
0
i will try this out right now killerbrasko2002 33 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

local players = game:GetService("Players") function teleAll(x, y, z) for _, plr in pairs(players:GetPlayers()) do if plr.Character then plr.Character:MoveTo(x, y, z) end end end teleAll(workspace.Spawner.Position)
0
thank you, you also answered this, but he did first i appreciate it =) killerbrasko2002 33 — 5y

Answer this question