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

Teleporting a specific player?

Asked by 8 years ago

So I am now having trouble with the teleporting part for the other players. It teleports the sniper fine. But won't teleport the other players

Gives me this error: "Torso is not a valid member of Player, Line 44 (Or in this post, line 16)

local players = game.Players:GetChildren()

    print(#players)


 if #players >= 2 then

        local sniper = players[math.random(1,#players)]
    local chosenName = sniper.Name
        local weapon = game.Lighting.Sniper
        weapon.Parent = sniper.Backpack
    sniper.Character.Torso.CFrame = game.Workspace:FindFirstChild("SniperPosition").CFrame * CFrame.new(0,1,0)

    for i,v in pars(players) do
        if v.Name ~= chosenName then
            v.Torso = game.Workspace:FindFirstChild("PlayerPosition").CFrame * CFrame.new(0,1,0) -- This part.
        end
    end


1 answer

Log in to vote
2
Answered by 8 years ago

Basically all you have to do is make a variable and define it as the name of the player. After doing this you can teleport the rest. So in the condition on line 29 add the following

local players = game.Players:GetChildren() --Part I need help with.

    print(#players)


 if #players >= 2 then

        local sniper = players[math.random(1,#players)]
    local chosenName = sniper.Name
        local weapon = game.Lighting.Sniper
        weapon.Parent = sniper.Backpack
    sniper.Character.Torso.CFrame = game.Workspace:FindFirstChild(ItemHere).CFrame * CFrame.new(0,1,0)

    for i,v in pars(players) do
        if v.Name ~= chosenName then
            v.Torso = game.Workspace:FindFirstChild(ItemHere).CFrame * CFrame.new(0,1,0)

        end
    end

This script should teleport the players without the name of the chosen sniper

~~Hope i helped

0
Hmmm I did that but now it is saying "Argument 1 missing or nil, Line 39 I put in the name of the brick where I wanted them to teleport to so I'm not sure whats up. Jord_guitar 50 — 8y
Ad

Answer this question