Hello, it's to know if my countdown client script is good. 0 = the player leave (not the game), 10 = when the player is solo and 20 when the player play vs another player.
MenuCountdownEvent.OnClientEvent:Connect(function(Duration)
CurrentCountdownID += 1
local CountdownInstanceId = CurrentCountdownID
PlayTextButton.Interactable = false
if Duration == 0 then
return
end
for i = Duration, 1, -1 do
if CountdownInstanceId ~= CurrentCountdownID then
return
end
if Duration == 10 then
PlayTextButton.Text = "Play solo in " .. i .. "s"
elseif Duration == 20 then
PlayTextButton.Text = "Starting duo in " .. i .. "s"
end
task.wait(1)
end
if CountdownInstanceId == CurrentCountdownID then
if Duration == 10 then
PlayTextButton.Interactable = true
PlayTextButton.Text = "Play solo"
elseif Duration == 20 then
PlayTextButton.Interactable = false
PlayTextButton.Text = "Starting duo ..."
end
end
end)