Humanoid Teleporting Into Block

Hello, I am creating a little obby game so when you touch the red (the floor) you get teleported back to the start (Orange block)

  1. Basically on test run when I touch the red, it does bring me back to the Orange block (Named TeleportTangerine). However, I am stuck in the block.
    image

I would like to know if there is a way to teleport the humanoid to be standing on top of that block, or to teleport the human to just be touching the block.

Here is my code so far:

local pad = script.Parent
local teleportTo = workspace.TeleportTangerine

pad.Touched:connect(function(hit)
 local humanoid = hit.Parent:FindFirstChild("Humanoid")
 if humanoid then
  local humanoidRoot = hit.Parent:FindFirstChild("HumanoidRootPart")
  if humanoidRoot then
   humanoidRoot.CFrame = teleportTo.CFrame
  end
 end
end)

Thank you for your help in advance, I am pretty new to scripting >.<

Maybe you can try block.Position + Vector3.New(0,5,0), or just call

Humanoid.Parent:MoveTo(tangerineblock.Position)

(note the humanoid.Parent) since the player character is a model. If you want to use MoveTo() in the future though, you need a primary part for the model you’re moving but the player character itself has a primary part

You could just set the teleport block to not cancollide if there is a block underneath to stop you from falling into the void, or you could simply teleport the player to above the block by adding 3 studs onto the Y Coordinate.

Part.CFrame = NewPart.CFrame + Vector3.new(0,3,0)
1 Like

I get what that means but where do I put that line :sweat_smile:

do humanoidroot.CFrame = teleportto.CFrame + Vector3.new(0,2,0)

The problem here is that when you set a position that position is in the center of the object so you teleport the rootpart inside the center of the object

1 Like

Did you figure it out already?

Why the two-year bump though?

<qqqqq

Idk I just got here. Character

Not yet haha :sweat_smile: didn’t know this post was still findable on here

Your script works, maybe you should add an invisible and unenabled CanCollide brick on the tangerine.

local pad = script.Parent
local teleportTo = workspace.TeleportTangerine -- put the invisible and unenabled CanCollide brick name for the workspace

pad.Touched:connect(function(hit)
 local humanoid = hit.Parent:FindFirstChild("Humanoid")
 if humanoid then
  local humanoidRoot = hit.Parent:FindFirstChild("HumanoidRootPart")
  if humanoidRoot then
   humanoidRoot.CFrame = teleportTo.CFrame
  end
 end
end)

2 Likes