local TPS = game:GetService("TeleportService")
workspace.Part.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
TPS:Teleport(placeId,Player)
end
end)
A very simple script. Let me know if there’s any bugs.
I would recommend using TeleportAsync for its extra features.
local TPS = game:GetService("TeleportService")
workspace.Part.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
TPS:TeleportAsync(placeId,{Players}, TeleportOptions)
end
end)
View teleport options docs or remove them, replace place id with the id of your place, and replace Players with your group of players or single player. Don’t remove the braces.
Sorry for the very late response, so I tried the script and it haven’t work…
Maybe I did something wrong somewhere?
This is it:
local TPS = game:GetService("TeleportService")
workspace.Part.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
TPS:TeleportAsync(11942106641,{Players}, TeleportOptions)
end
end)
Also my script doesn’t teleport to a starting place but to a normal place so maybe that’s the problem?
Well first of all, you need to make {Players}{Player} because the players that are teleporting is your player, and the teleport options are optional. You can create them by using Instance.new(“TeleportOptions”)
local TPS = game:GetService("TeleportService")
workspace.Part.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
TPS:TeleportAsync(11942106641,{Player})
end
end)
I tried this script I found from a Youtube video and it worked.
local GameId = "0" -- Put in your game ID here.
function Touched(Player)
local FromChar = game.Players:GetPlayerFromCharacter(Player.Parent)
if FromChar then
local TeleService = game:GetService("TeleportService")
TeleService:Teleport(GameId,FromChar)
end
end
script.Parent.Touched:Connect(Touched)