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

Teleporting all players (Easy?) to a Parts CFrame

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

✓ Accepted answer

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

1 comment

0

i will try this out right now


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)

1 comment

0

thank you, you also answered this, but he did first i appreciate it =)

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