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

How do I make this part of the script do this?

Asked by 10 years ago

What I want this script to do is to teleport a player to a certain part of my world. The only problem is is that I don't know how to make sure that the script doesn't only teleport a certain player (Player1) but all people who join the game. For example, when TheGamer101 joins the game, I want TheGamer101 to be teleported. But at the same time, when I join the game, I want to be teleported to the same destination. How do I do that with a script?

Here's the script.

game.Workspace.Player1.Torso.CFrame = CFrame.new(Vector3.new(-4384.4, -397.303, 3167.8))

2 answers

Log in to vote
1
Answered by 10 years ago
game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character.Torso:MoveTo(Vector3.new(-4384.4, -397.303, 3167.8))
    end)
end)

Since this was so simple I decided to give you the script. Use MoveTo next time however as it's easier

Ad
Log in to vote
-1
Answered by
acecateer 130
10 years ago

Here you go good sir, fresh from the land of notepad.

Special_people = {"LOLOLOLOLMRocks37Alt", "TheGamer101"}

function Teleport(plr, target)
    wait()
    plr.Character.Torso.CFrame = target
end

Game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        for a,c in pairs(Special_people) do
            if plr.Name == c then
                Teleport(plr, CFrame.new(-4384.4, -397.303, 3167.8))
            end
        end
    end)
end)
0
There is a better way to do this. He also want's ALL players to teleport NovusTheory 133 — 10y
0
No I'm pretty sure he wanted CERTAIN players to teleport. acecateer 130 — 10y

Answer this question