Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone help me with my teleportation script?

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

✓ Accepted answer
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

2 comments

0

If you use this answer and thought it was helpful it would benefit both of us if you clicked "Accept Answer" button.

0

Don't worry, but yeah thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.