Wait() integrated into a GUI

Hello, I am trying to achieve a system where when I run a wait() command, a GUI shows up with a countdown timer with how long the wait time was

I am completely stuck on what to do and I can’t find any resources for this, if you got any ideas drop them below!

1 Like
1 Like

You misunderstood what I meant, when I run a wait() in my loop, a countdown starts with how long until the loop reiterates

1 Like

Like do you want a timer for low long the wait() time was? I don’t really understand what you are trying to achieve.

1 Like

Okay so this is what I have

local cooldown = 20
local countdown = 0
while true do 
local args = {
        workspace.Baseplate.Cities.Jamaica:GetChildren(),
    [2] = "Develop City"
}
workspace.GameManager.CreateBuilding:FireServer(unpack(args))
 wait(cooldown)
end 


What I want is for every time the wait(cooldown) starts, a timer show up under the countdown variable which counts until the loop reiterates

2 Likes

Do u want a Timer go up until something happens?

1 Like

Basically what I want is for when the wait(cooldown) runs, a 20 second timer counting down starts

1 Like

Hmmm, doesn’t wait() yield the script though?

1 Like

Do u want first GetChildren then Timer or first the Timer then Jamaica GetChildren()?

1 Like

but I want the user to know how long until the loop reiterates

1 Like

Well this script wont run forever because you never reset the countdown value.

1 Like

Jamaica GetChildren() first and then the cooldown starts

1 Like

Create a TextLabel, then:

local cooldown = 20

local textLabel = "Your TextLabel"
textLabel.Text = cooldown

while true do 
	local args = {

		workspace.Baseplate.Cities.Jamaica:GetChildren(),
		[2] = "Develop City"

	}

	repeat task.wait() do

		textLabel.Text -= 1

		task.wait(1)

	until textLabel.Text == 0
	workspace.GameManager.CreateBuilding:FireServer(unpack(args))

end
2 Likes

Then put while task.wait(1) under GetChildren()

2 Likes