I want to make a teleport for when you touch a brick that it teleports you to my friends place. Please help! (Also It Isn't To Get Him Visits We just Want To Reduce Lag In My Game)
COMMUNITY QUESTION
How do I Make a Teleport To Another Place?
2 answers
Here script, change the ID of your friend's place's id.
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):TeleportToSpawnByName(*IDHERE*, "Your friend's place's spawnname", player)
end
end
script.Parent.Touched:connect(onTouched)
Here is a great wiki article that can help you.
But here is my interpretation:
local teleportid = 0 --Put the place ID here
local player = "Telamon" --put which player to teleport
game:GetService('TeleportService'):Teleport(teleportid, game.Players:FindFirstChild(player))
However, if you want it to teleport everyone in the game, here is the proper code:
local teleportid = 0 --Put the place ID here
for i,v in pairs(game.Players:GetPlayers()) do
game:GetService('TeleportService'):Teleport(teleportid, v)
end
Lastly, if you want it where everytime someone joins, it teleports them, here is how it would go:
local teleportid = 0 --Put the place ID here
game.Players.PlayerAdded:connect(function(plr)
game:GetService('TeleportService'):Teleport(teleportid, plr)
end)
Hope that helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Your welcome and if its work please accept the answer :D
Thanks! Helped a ton!