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

Can someone help me with my teleportation script?

Asked by 10 years ago
local Players = game.Players
local player = Players:GetChildren()
local pickedPl = player[math.random(1, #player)]
local Name = pickedPl.Name

Players.Name.Torso.CFrame.new(Vector3.new(216.601, 242.901, -60.497))

It says that 'Name' isn't part of players, but how do I make it so it the script reads the picked players name so it can teleport?

-Update I couldn't think of the correct tag.

1 answer

Log in to vote
1
Answered by 10 years ago
local Players = game.Players
local player = Players:GetChildren()
local pickedPl = player[math.random(1, #player)]

pickedPl.Character:MoveTo(Vector3.new(216.601, 242.901, -60.497))

You were trying to teleport the players to a certain part and not using the pickedPL value. You could move the torso I believe but using MoveTo is generally better. Also I don't know what you were trying to do with .Name but if you just used the picked player value it will give you a player.

NOTE: If you want a humanoid inside of a model to walk instead of teleport do

Model.Humanoid:MoveTo(part, part.Position)
--When putting in parts for the position to "MoveTo" you are required to put the part and then the part.Position
0
If you use this answer and thought it was helpful it would benefit both of us if you clicked "Accept Answer" button. VariadicFunction 335 — 10y
0
Don't worry, but yeah thanks. CheeseDevie 30 — 10y
Ad

Answer this question