Help with an teleport script

Hello, Im creating an test and I need know how to do an script to when u press an block it teleports u to another place, I’am new scripting…

2 Likes

Do you want a click or on touch teleport?

Touch, please.

                n.        nghjhgtyujhgyu7j(spam for i can post it)

I can’t remember off my head, I don’t programme much.

Is it another game/place or teleport you to another part of the map

Hi there, MHB. Here’s a script for teleporting when you touch a brick:

local TeleportService = game:GetService(“TeleportService”)
local id = yourPlaceId
local brick = script.Parent

brick.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if humanoid then
local player = game.Players:GetPlayerFromChracter(hit.Parent)
TeleportService:Teleport(id, player)
end

end)

I hope this helps!

Also, if you wanted to have a player to teleport to another part of the map, here it is:

local brick = script.Parent
local receiver = game.Workspace.PartYouWantToTeleportTo
brick.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if humanoid then
hit.Parent.HumanoidRootPart.Position = receiver.Position
end

end)

Let me know if you have any questions!

For future reference, put scripting questions in #help-and-feedback:scripting-support , but other than that I think @WarioSvug has the solution.

Good luck on your project!

Thanks u, I relly need that for my game. :smiley: :smiley:

1 Like