How do I make a part that if touched by player it will teleport all players in server to a position?

What I want to achieve: Part that if it is touched by a player, it wont just teleport that player, but every other player in the server will also be teleported to the position that the teleporter teleports to

The issue is that I just don’t know how to do it lol. I know how to make a teleporter that teleports just the one player who touched it to another location but I don’t know how to make the whole server do that when one part is touched by one person.

I didn’t really try anything for it but ill try to find videos on how to do it

So yeah pretty much I just wanna know how to make a teleporter that if a player touches it will send everybody to the teleported location with the player who touched it

1 Like

Try this out:

local PS = game:GetService("Players")

local part: BasePart
local cframe: CFrame

part.Touched:Connect(function(touch)
	local char = touch:FindFirstAncestorWhichIsA("Model")
	local player = char and PS:GetPlayerFromCharacter(char)
	
	if player then
		for _,v: Player in ipairs(PS:GetPlayers()) do
			local char = v.Character
			
			if char then
				char:PivotTo(cframe)
			end
		end
	end
end)
2 Likes

Thank you so much! There weren’t any yt vids about it so I am glad someone could help me out :smiley:

what does
local part: BasePart
and
local cframe: CFrame
do? and should i keep script in workspace or put it in the part

local part = (game.Workspace. your part)
local cframe = (position of part you want the player to be tpd to)
Put the script inside the part