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

How to teleport players onto parts of a model?

Asked by
Vido01 5
8 years ago

m = Instance.new("Message")

h = Instance.new("Hint")

m.Parent = game.Workspace

h.Parent = game.Workspace

while true do

if game.Players.NumPlayers == 1 then

    m.Text = "Loading-Please wait."

    wait(3)

    Spawns = game.Workspace.Elevator.McSwagon:GetChildren()

    Spawnz = game.Workspace.Illuminboti:GetChildren()

    m.Text = "Teleporting to Elevator"

    wait(1)

    for i, v in pairs(game.Players:GetPlayers()) do

         name = v.Name

         check = game.Workspace:FindFirstChild(name)

        if check then

            checkHumanoid = check:FindFirstChild("Humanoid")

            if checkHumanoid then

                check:MoveTo(Spawns[1].Position)

            end

        end

    end

    wait(10)


    for i, v in pairs(game.Players:GetPlayers()) do

        if checkHumanoid then

            check:MoveTo(Spawnz[1].Position)

        end

    end

end

wait(10)

end

So the goal of this script is as follows: To teleport 10 different players onto 10 different parts, with each player landing on a different part. The script works fine as is, but the problem is that whenever the players are teleported they all spawn on one part, even though there are 10 parts in each McSwagon and Illuminboti (the models which house the 10 parts.) I'm sure it's an easy fix that I'm just not seeing so if you know what the solution is I would greatly appreciate it.

1
Replace Spawnz[1] with Spawnz[i] 1waffle1 2908 — 8y
0
Oh RIP I'm dumb thanks for the help though. Vido01 5 — 8y

Answer this question