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

How would I go about teleporting 2 players?

I was making my game but scripting is not my strongest area and I would like to know how to teleport 2 players stored in 2 variables 1 called F1 and the other F2. It would tp these to a given location and the other players (left over) to a different location again given.

1 answer

✓ Accepted answer

That would be something like this, it depends on what you have stored in F1 and F2. If they're characters then this will work.

local Area1 = Vector3.new() -- Put your first area and second area here
local Area2 = Vector3.new() -- this should be a Vector3 value
for index, player in pairs(game.Players:GetChildren()) do -- We loop through all players
	if player.Name == F1.Name or player.Name == F2.Name then -- Here we check if the current player is either player F1 or F2
		player.Torso.Position = Area1 -- If it's true then teleport to Area 1
	else
		player.Torso.Position = Area2 -- If it's false then teleport to Area 2
	end

3 comments

0

Is Vector3 a set of co-ordinates if not how would I go about using them?

0

Yes, you can do Vector3.new(0, 10, 25). These numbers represent the coords.

0

Thanks for the help!

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