I'm trying to make a game where when any player stands in a certain location they all get teleported after a period of time. I have the teleportation script already, but I don't know how to make the queue part.
local MapSelect = script.Parent.MapSelect local time = 30 local NumberOfMaps = script.Parent.NumberOfMaps.Value while true do repeat wait() until script.Parent.time.Value == 0 MapSelect.Value = math.random(1,NumberOfMaps) local player = game.Players:GetPlayers() if MapSelect.Value == 1 then for i = 1, #player do player[i].Character:MoveTo(game.Workspace.Part1.Position) script.Parent.time.Value = 3 end end if MapSelect.Value == 2 then for i = 1, #player do player[i].Character:MoveTo(game.Workspace.Part2.Position) script.Parent.time.Value = 3 end end if MapSelect.Value == 3 then for i = 1, #player do player[i].Character:MoveTo(game.Workspace.Part3.Position) script.Parent.time.Value = 3 end end end
Excuse the bad formatting I'm on mobile.
intermission_interval = 30 --time left in seconds function countDown() --count down to 0 seconds for i = intermission_interval, 0, -1 do print(i, " seconds remaining...") wait(1) end end --start countdown... countDown() --teleport players when countdown is over teleportPlayers ()
You can keep track of who's in the box calling the box's getTouchingParts() function and adding all the players you find in them into a table
playersInRound = {} touchingParts = game.Workspace.BoxPart:GetTouchingParts() --put all the players touching the brick into the playersInRound table for _, part in ipairs(touchingParts) do if(game.Players:FindFirstChild(part.Parent.Name) and not playersInRound[part.Parent] )then table.insert(playersInRound, part.Parent) end end --and then we can teleport the players by calling the teleport function: teleportPlayers(playersInRound)
try something like this:
local s = script.Stat t = 0 while true do t = 15 repeat t = t-1 s.Value = "Intermission.. "..t wait(1) until t == 0 s.Value = "Game starting!" wait(2) local plrs = game.Players:GetChildren() for i = 1,#plrs do local num = math.random(1,2) plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports["Part"..num].Position) end t=100 repeat t = t-1 s.Value = t.." seconds left" wait(1) until t ==0 end
this is from zingo dev. check out his vids for the full tutorial. just use this script. here are some links to the vids: first vid https://www.youtube.com/watch?v=SKnbCF4d558 sceond vid https://www.youtube.com/watch?v=UCK1vm1gz-I