So i have this story game and I just can’t get this teleportation system to work
Here is my code script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild(“Humanoid”) then
local Character = Touched.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
table.insert(PlayerTable,Player)
else
return
end
if #PlayerTable >= 1 then
print(“Almost yay”)
local Server = TeleportService:ReserveServer(4701493313)
TeleportService:TeleportToPrivateServer(4701493313,Server,Players)
end
end)
Is this the code from “Gate” The reason why im asking is because there’s a problem on line 38 of the code
but the one u gave us doesn’t seem to go past line 13.
Are you running this script on the client or on the server? (Script or LocalScript)
Also, I’m pretty sure you should wrap this in a pcall function to prevent the script halting when errors occur, like this.
The error is this line
local Code = TeleportService:ReserveServer(4701493313)
also i made a pcall now
local Players = game:GetService"Players"
local PlayerTable = {}
local TeleportService = game:GetService(“TeleportService”)
local Id = 4701493313
–//TeleportHandler
script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild(“Humanoid”) then
local Character = Touched.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
table.insert(PlayerTable,Player)
else
return
end
if #PlayerTable >= 1 the
print(“Almost yay”)
local Succes, Error = pcall(function()
local Code = TeleportService:ReserveServer(4701493313)
end)
if Succes then
print(“Succes”)
local Playerss = Players:GetPlayers()
local Code = TeleportService:ReserveServer(4701493313)
TeleportService:TeleportToPrivateServer(4701493313,Code,Playerss)
else
print(Error)
end
end
end)
It’s teleporting but i need to type game.Players:FindFirstChild(“Andueey”) and then it would teleport but I can’t get the teleport thing to teleport everyone in the table
–//Variables
local PlayerTable = {}
local TeleportService = game:GetService(“TeleportService”)
local Id = 3387051590
–//TeleportHandler
script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild(“Humanoid”) then
local Character = Touched.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
table.insert(PlayerTable,Player)
else
return
end
if #PlayerTable >= 1 then
TeleportService:Teleport(Id,PlayerTable)
end
end)
It’s giving a warning Invalid player to teleport
I thought you wanted to use :ReserveServer() so I had made this script, however looking at the last script you posted I’m not sure if this is what you want to do.
wait()
local Players = game:GetService("Players")
local PlayerTable = {}
local TeleportService = game:GetService("TeleportService")
script.Parent.Touched:Connect(function(Touched)
if Touched.Parent:FindFirstChild("Humanoid") then
local Character = Touched.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
table.insert(PlayerTable, Player)
if #PlayerTable >= 1 then
local Succes, Error = pcall(function()
local Code = TeleportService:ReserveServer(game.PlaceId)
end)
if Succes then
local Code = TeleportService:ReserveServer(game.PlaceId)
TeleportService:TeleportToPrivateServer(game.PlaceId, Code, PlayerTable)
else
print(Error)
end
end
end
end)