I want to send a group of people who have a tag in their character called "car1" or "car2" to a private server. what i tried doing was making a table for the people who have this tag and inserting them into it. this seems to not work, and i would like to know how to do this
local tpService = game:GetService("TeleportService") local placeID = 5192786069 local players = game.Players:GetPlayers() local carOnePeople = {} local carTwoPeople = {} local debounce = false local players = game.Players:GetPlayers()
for i, v in pairs(players) do if v.Character then if v.Character:FindFirstChild("Car1") then table.insert(carOnePeople, v) end if v.Character:FindFirstChild("Car2") then table.insert(carTwoPeople) end end end
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then if player.Character:FindFirstChild("Car1") then local accessCode = tpService:ReserveServer() tpService:TeleportToPrivateServer(placeID, accessCode, {carOnePeople}) elseif player.Character:FindFirstChild("Car2") then local accessCode = tpService:ReserveServer() tpService:Teleport(placeID, accessCode, {carTwoPeople}) end end end end)
