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

Force teleport players to a Part?

Hey there, new scripter here

I was wondering how i would go about Force Teleporting players to a certain Part?

Thanks!,

1 comment

0

Set the player’s cframe to the part’s cframe

2 answers

✓ Accepted answer
local part = workspace.Part -- Change this

for i,v in next, game.Players:GetPlayers() do -- loop through the players
 local chr = v.Character 
	if chr and chr:FindFirstChild("HumanoidRootPart") then  -- check if they have a character and humanoidrootpart
		chr:SetPrimaryPartCFrame(part.CFrame) -- set their cframe to the part's cframe.
	end
end

3 comments

1

Thanks!

0

ummm you can change the next to pairs

0

yes you can.

local PartToTeleportTo = game.Workspace:FindFirstChild("") --// Fill this in with the part name.

for i,v in pairs(game.Players:GetPlayers()) do
	v.Character.HumanoidRootPart.CFrame = PartToTeleportTo.CFrame
end

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