Is there a way to do this? I need to teleport a player to a place in my map.
COMMUNITY QUESTION
Teleport specific player to point in map?
2 answers
target = CFrame.new(0,0,0) -- Position here
script.Parent.Touched:connect(function(hit)
if hit.Parent then
humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Parent.HumanoidRootPart.CFrame = target + Vector3.new(0, 1, 0)
end
end
end)
This is a .Touched teleport. For more information check out the roblox wiki - https://wiki.roblox.com/index.php?title=Teleporting_Within_a_Place
debounce = true
part = script.Parent
part.Touched:Connect(function()
debounce = false
if part:FindFirstChild("Humanoid") ~= nil then
local plr = game.Players:GetPlayerFromCharacter(part) -- Prevents the possible NPC from touching this part
if plr then
humanoid = part:FindFirstChild("Humanoid")
if humanoid.RigType == Enum.HumanoidRigType.R6 then -- Check for R6
humanoid.Parent.Torso.CFrame = CFrame.new(Vector3.new(5,0,10)) -- Example position
elseif humanoid.RigType == Enum.HumanoidRigType.R15 then -- Check for R15
humanoid.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(5,0,10)) -- Again, another example position
end
end
end
wait(1)
debounce = true
end)
Notice lines 1,4,6,7,9,10,11,12,16 and 17. ROBLOXAIN2 forgot about that.
3 comments
0
I want it to teleport the player when they join
0
Change "part.Touched" to "game.Players.PlayerAdded" and modify the script accordingly.
0
would you be able to answer with the edited script?
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
what are you talking about