|
| 28 Sep 2016 09:30 AM |
How do I set a variable to what a function returns and wait until that function yields before continuing the script?
It was something like my title I swear, but I can't remember it exactly. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 09:33 AM |
| The script always yield before a function returns. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 09:35 AM |
oh.
I probably wrote the script wrong.
Alright, thread's over everyone. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 12:19 PM |
It cant be a function
It has to be an event
|
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 12:23 PM |
CharacterAdded:wait() ?
https://www.roblox.com/library/359444683/H-W-A-Arrow |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 12:26 PM |
CharacterAdded is an event
here is another example
local Bindable = Instance.new("BindableEvent")
local Event = Bindable.Event
Event:connect(function() print("YAY") end)
coroutine.wrap(function() Event:wait() print("it fired") end)()
wait(1) Event:Fire() |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 12:28 PM |
probably
Bindable:Fire()
instead
because i think Event:Fire() might not work
but yes it only works for events unless you make a table with a wait function
local fake = {fire = false;} function fake:wait() repeat wait until self.fire end
coroutine.wrap(function() fake:wait() print("fired") end)()
wait(1) fake.fire = true |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2016 12:29 PM |
repeat wait() until self.fire *
self is just returned by the method |
|
|
| Report Abuse |
|
|