I know this question may sound a bit weird, though please bear with me as I try to explain.
Also, I know people will try to suggest that I use .RenderStepped:Wait()
, though I looked at the wiki article on RBXScriptConnections
(Wiki Link) and I could not find any documentation on such function. I even tried it myself and it didn't appear to work.
What I was initially attempting to do here is create my own wait function that would wait for a RenderStepped period of time. I knew in order to do this I'd need to somehow embed a RenderStepped
function inside of my main function and return the main function after a certain period of time (which the RenderStepped thing would track). It would look something like this:
function waitF(sec) local beg = tick() local f f = game:GetService("RunService").RenderStepped:connect(function(step) if tick() - beg > sec then --initiate the returning of the main scope somehow f:Disconnect() end end) return --return somehow end
Though I don't know how I'd go about initiating the return. I would have to somehow yield the return
part somehow and disconnect the yielding when the f
function tells it to.