Hi, it’s been a while since I posted, sorry about that.
I was wondering if anyone knows how to automatically hide a SurfaceGui (or really Ui in general) after 3 seconds have passed since it was activated (I’m using a function to toggle visiblity of the UI).
It’s basically a volume bar for a TV I’m making. Here’s what I tried doing:
local RecentChange = tick()
--Some code later...
task.spawn(function()
task.wait(3)
if math.round(RecentChange) > 3 then
GUI.Enabled = false
end
end)
However, this didn’t work. If anyone has an idea, or knows how to do it themselves, please let me know! Thank you
local uiCloserThread: coroutine;
local function onUIActivated()
ui.Visible = true
-- do stuff
if uiCloserThread then
task.close(uiCloserThread)
end
uiCloserThread = task.delay(3, function()
ui.Visible = false
end)
end