Help with function

I really need a Teleport function for a project

But the thing is that l don’t have the knowledge to script it right
All I would like is to steer me in the Right direction, examples and other, I need help on a “Teleport all players to a part function”
Help would be appreciated!

You could make the players HumanoidRootPart's position equal the part’s position.

But how would I get to the HumanoidRootPart?

You would access the player’s HumanoidRootPart from their character (Player.Character).

local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

This is how you loop through all the players:

local Players = game:GetService("Players")
for _, player in pairs(Players:GetPlayers()) do

end

This will help you to teleport, to get all humanoidRootParts do this

for _, v in pairs(game.Players:GetPlayers()) do
	local humanoidRootPart = v.Character.HumanoidRootPart
end

OK thank you all, I’ll try the options

There are many ways which you can teleport a player’s character…
Using MoveTo to move their character position

local Part = workspace.Part
local Character = Player.Character
if Character then
    Character:MoveTo(Part.Position)
end

Using :PivotTo to move the character CFrame

local Part = workspace.Part
local Character = Player.Character
if Character then
    Character:PivotTo(Part.CFrame)
end

You can use Model:PivotTo() to move an entire model to a CFrame.

local Part = workspace.Part
local Character = Player.Character or Player.CharacterAdded:Wait()
Character:PivotTo(Part.CFrame)

Thank You All for your help!
@msix29’s script worked, Thanks!

1 Like