Hi, I’m trying to make it so that if the player presses a button, a tag is inserted and an event firing happens. I’m trying to make it so that the player with the tag teleports. Here is my code:
local TS = game:GetService("TeleportService")
local RacingServerID = NUMBER ID
local ReservedServer = TS:ReserveServer(RacingServerID)
game.ReplicatedStorage.Events.AddPlayerToRoom.OnServerEvent:Connect(function(player)
local PlayerList = {}
table.insert(PlayerList, player)
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("Room1") then
TS:TeleportToPrivateServer(RacingServerID, ReservedServer, v)
end
end
end)