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

How do you teleport 2 players differnt place's?

Asked by
Smach28 10
6 years ago

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

0
Do you mean teleport as in set the CFrame (you can use it as a position) of the player? GoldenPhysics 474 — 6y
0
I mean like how do I tp two players to two seperate locations while the script knows who is supposed to go where. Smach28 10 — 6y
0
You'll have to store some information somewhere that let's you figure out in a script who goes where. GoldenPhysics 474 — 6y
0
Wiki post for more info on that? Smach28 10 — 6y
View all comments (3 more)
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. GoldenPhysics 474 — 6y
0
ik where I want them to spawn Smach28 10 — 6y
0
Nvm, I have an idea, Could you pls post a answer so I can accept your answer Smach28 10 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

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.

Ad
Log in to vote
0
Answered by 6 years ago

You can teleport people by using this service.

0
Yes, except the question is about "teleporting" players to different locations within the same game, not between different games. GoldenPhysics 474 — 6y

Answer this question