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

How do you teleport 2 players differnt place's?

Hi, so I'm working on a script which tp's one player to his base, and other to there base, how do I set so that they spawn where they need to spawn, and the script knows who goes where. Pls, give me a wiki link and/or an example, thanks! :D

7 comments

0

Do you mean teleport as in set the CFrame (you can use it as a position) of the player?

0

I mean like how do I tp two players to two seperate locations while the script knows who is supposed to go where.

0

You'll have to store some information somewhere that let's you figure out in a script who goes where.

0

Wiki post for more info on that?

0

http://wiki.roblox.com/index.php?title=Teleportation For how to teleport within a game. You'll need to figure out where to put each player, though.

0

ik where I want them to spawn

0

Nvm, I have an idea, Could you pls post a answer so I can accept your answer

2 answers

✓ Accepted answer

To teleport players to different locations in your game, look at this guide on the wiki.

If you want to have a spawn part where players are teleported to, you can add a part to the explorer and simply reference that part in you script. That way, if you wanted to change where players spawn, you simply have to move the part.

local spawnPartOne = workspace.path.to.spawnPartOne
local spawnPartTwo = workspace.path.to.spawnPartTwo
local teamOne = game.Teams.path.to.teamOne
local teamTwo = game.Teams.path.to.teamTwo

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid", 5)
		if not humanoid then
			print("The humanoid wasn't found in the allowed time!")
			return
		end
		if player.Team == teamOne then
			character.HumanoidRootPart.CFrame = spawnPartOne.CFrame
		elseif player.Team == teamTwo then
			character.HumanoidRootPart.CFrame = spawnPartTwo.CFrame
		end
	end)
end)

This script could be made a little nicer, but I think it shows what you want.

You can teleport people by using this service.

1 comment

0

Yes, except the question is about "teleporting" players to different locations within the same game, not between different games.

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