Is there a way to do this? I need to teleport a player to a place in my map.
01 | target = CFrame.new( 0 , 0 , 0 ) -- Position here |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 |
05 | if hit.Parent then |
06 | humanoid = hit.Parent:FindFirstChild( "Humanoid" ) |
07 | if humanoid then |
08 |
09 | humanoid.Parent.HumanoidRootPart.CFrame = target + Vector 3. new( 0 , 1 , 0 ) |
10 | end |
11 | end |
12 | 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
01 | debounce = true |
02 | part = script.Parent |
03 | part.Touched:Connect( function () |
04 | debounce = false |
05 | if part:FindFirstChild( "Humanoid" ) ~ = nil then |
06 | local plr = game.Players:GetPlayerFromCharacter(part) -- Prevents the possible NPC from touching this part |
07 | if plr then |
08 | humanoid = part:FindFirstChild( "Humanoid" ) |
09 | if humanoid.RigType = = Enum.HumanoidRigType.R 6 then -- Check for R6 |
10 | humanoid.Parent.Torso.CFrame = CFrame.new(Vector 3. new( 5 , 0 , 10 )) -- Example position |
11 | elseif humanoid.RigType = = Enum.HumanoidRigType.R 15 then -- Check for R15 |
12 | humanoid.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector 3. new( 5 , 0 , 10 )) -- Again, another example position |
13 | end |
14 | end |
15 | end |
16 | wait( 1 ) |
17 | debounce = true |
18 | end ) |
Notice lines 1,4,6,7,9,10,11,12,16 and 17. ROBLOXAIN2 forgot about that.
Closed as Not Constructive by BlackOrange3343, DeceptiveCaster, Amiaa16, User#20388, Axceed_Xlr, and theCJarmy7
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?