Sorry if the title didn’t make sense, I don’t know how to word it.
Basically I have this script made by @UseCode_Tap (TheDevKing) and I was wondering how to add a part before the roundLength countdown show the countdown to how long until you get your sword.
local roundLength = 180
I tried adding a wait at
local function roundTimer()
while wait() do -- I tried adding a wait(5) here
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1) -- I tried adding a wait(5) here
Status.Value = "Game: ".. i .." seconds left!"
end
end
end
But that just bugged it out.
Whole script
local roundLength = 180
local intermissionLength = 20
local InRound = game.ReplicatedStorage.Values.InRound
local Status = game.ReplicatedStorage.Values.GameStatus
local swordCount = false
local LobbySpawn = game.Workspace.LobbyTeleport
local GameAreaSpawn = game.Workspace.GameTeleport
InRound.Changed:Connect(function()
wait(1)
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame
swordCount = true
Status.Value = "You will be receiving your swords in 5 seconds"
wait(1)
Status.Value = "You will be receiving your swords in 4 seconds"
wait(1)
Status.Value = "You will be receiving your swords in 3 seconds"
wait(1)
Status.Value = "You will be receiving your swords in 2 seconds"
wait(1)
Status.Value = "You will be receiving your swords in 1 seconds"
wait(1)
Status.Value = "Fight!"
local sword = game.ReplicatedStorage.Tools.Sword:Clone()
sword.Parent = player.Backpack
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
player.Backpack.Sword:Destroy()
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
end
end
end
spawn(roundTimer)
Reason why the script above doesn’t work: The bottom of the script where the roundTimer function is over-writes the Status.Value before the “SwordCountdown” finishes.