Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i call a function after a timer is up?

Asked by
mikwbm 9
2 years ago

So i am trying to make a loading screen or waiting screen. The screen shows a timer that counts down till 0 from 20. I want to make a play button appear once the timer is has reached 0. How would i do that?

--Script that counts down from 20
local frame = script.Parent.Parent
local play = script.Parent.Parent.TextButton
local timer = script.Parent


for count = 20, 0, -1 do
    wait(1)
    timer.Text = (count)
end

Locations

--timer location
script.Parent.timer
--Frame Location
script.Parent
--Play button location
script.Parent.TextButton

Location of all my guis

https://imgur.com/a/4K7WkTZ

1 answer

Log in to vote
0
Answered by 2 years ago

All you need to do is create an if statement to see when the count reaches zero, then make the button visible.

local frame = script.Parent.Parent
local play = script.Parent.Parent.TextButton
local timer = script.Parent

for count = 5, 0, -1 do
    wait(1)
    timer.Text = (count)
    if count == 0 then --When timer reaches 0
        play.Visible = true --Make play button visible
    end
end
Ad

Answer this question