I was making my game but scripting is not my strongest area and I would like to know how to teleport 2 players stored in 2 variables 1 called F1 and the other F2. It would tp these to a given location and the other players (left over) to a different location again given.
That would be something like this, it depends on what you have stored in F1 and F2. If they're characters then this will work.
1 | local Area 1 = Vector 3. new() -- Put your first area and second area here |
2 | local Area 2 = Vector 3. new() -- this should be a Vector3 value |
3 | for index, player in pairs (game.Players:GetChildren()) do -- We loop through all players |
4 | if player.Name = = F 1. Name or player.Name = = F 2. Name then -- Here we check if the current player is either player F1 or F2 |
5 | player.Torso.Position = Area 1 -- If it's true then teleport to Area 1 |
6 | else |
7 | player.Torso.Position = Area 2 -- If it's false then teleport to Area 2 |
8 | end |