I’m trying to make a countdown that teleports the players when it hits 0 seconds but I really have no idea how to make it, I tried searching for tutorials on search engines but I couldn’t find what I’m looking for.
Can anyone help me do that, I don’t need full scripts I just need a guide on how to do that. Thank you!
local players = game:GetService("Players")
local break_time = 5 -- Break Time You Want
local game_spawn = workspace:FindFirstChild("Part Name") -- Part that Player Teleport to
local function Count() -- Make New Function
if game_spawn then -- If there is a Spawn Part in Worksapce
for players, all_players in pairs(players:GetPlayers()) do -- Get All Players
local gui = all_players.PlayerGui:FindFirstChild("Gui Name") -- Find Your Gui in all Player's Gui
local text_label = gui:FindFirstChild("TextLabel Name") -- Find Your Text Label in Gui
if gui and text_label then -- If there is a Gui in Player Gui and TextLabel in Gui
gui.Enabled = true -- Set Gui Enabled to True
text_label.Text = "" -- Set Text Label Text to Nothing
for i = break_time , 0, -1 do -- repeat below code until break_time goes to 0
task.wait(1)
text_label.Text = "Game Start After "..i.." Seconds" -- Change Text_Label Text
end
--- After Finishing Loop
task.wait(1) -- Wait 1 Seconds
gui.Enabled = false -- Set Gui Enabled to False
all_players.Character:PivotTo(game_spawn.CFrame) -- Teleport All Players to SpawnPart You Selected(3 line)
end
end
end
end
game.Players.PlayerAdded:Connect(Count) -- Start Count Function
For _, player in pairs(game.Players:GetChildren()) do
Local char = player.character
If player.char then
If char:FindFirstChild(”HumanoidRootPart”) then
Player.HumanoidRootPart.CFrame = Part.CFrame
end
end
end