Humanoid Teleporting to another building in-game

What do you want to achieve?: When you touch a part, you get teleported to a room far away in your game. When returning, same process but back to the main building

Idea:


Touch this wall painting. Script should process when humanoid has touched the part.

Successfully teleported.

Return to the Main building:


Script should process again when humanoid has touched the part.

Why am I not looking for tutorials? (etc YouTube): All these tutorials confuse me and they either do not work or they are for something else. That it why I am asking the DevFourm to help since they have helped me a lot in scripting.

Could someone possibly tell me a type of script or script which would work in this process.

Thank You.

1 Like
part1.Touched:Connect(function(p)
  --check that "p" is part of a character
  local char = p:FindFirstAncestorOfClass("Model") --find the model, we use ancestor because a tool/hat handle may touch the part
  local human = if char then char:FindFirstChild("Humanoid") else nil --find the humanoid

  if human then
    char:MoveTo(part2.Position) --move the character to a new position
  end
end)

Not going to code you an entire system, just showing how to move a character when it touches a part

1 Like