|
| 13 Mar 2014 12:04 PM |
| Can you make things continue during a wait() I want something to happen during the wait so it can stop it |
|
|
| Report Abuse |
|
|
Techante
|
  |
| Joined: 17 Oct 2011 |
| Total Posts: 2101 |
|
|
| 13 Mar 2014 12:06 PM |
| WHAT? MAKUS SENSUS PLEASES!!! |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2014 12:08 PM |
| I want a certain part of a script to continue during a wait() So I can break it. |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 13 Mar 2014 12:11 PM |
coroutine.wrap(function() wait(5) print("look I print during a wait!") end)() print("starting wait") wait(10) print("I printed after the wait") |
|
|
| Report Abuse |
|
|
| |
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 13 Mar 2014 12:16 PM |
Coroutines start a new thread which runs in parallel with the current thread. Well its more complicated than that but that is how it works simply. Look here for more info.
http://wiki.roblox.com/index.php/Beginners_Guide_to_Coroutines |
|
|
| Report Abuse |
|
|
|
| 13 Mar 2014 12:21 PM |
| How would I break the wait? |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 13 Mar 2014 12:42 PM |
coroutine.wrap(function() wait(5) print("look I print during a wait!") end)() print("starting wait") for i=1,10 do wait(1) if i>5 then break end end print("I printed after the wait") |
|
|
| Report Abuse |
|
|
Techante
|
  |
| Joined: 17 Oct 2011 |
| Total Posts: 2101 |
|
|
| 14 Mar 2014 12:24 PM |
| Oooooh, yeh, what guy above said, I was unsure what you meant, Sooz brah! |
|
|
| Report Abuse |
|
|
dedushy
|
  |
| Joined: 06 May 2011 |
| Total Posts: 2125 |
|
|
| 14 Mar 2014 01:14 PM |
| Wait so what you want again? |
|
|
| Report Abuse |
|
|
dedushy
|
  |
| Joined: 06 May 2011 |
| Total Posts: 2125 |
|
| |
|
UnStunned
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 122 |
|
|
| 14 Mar 2014 01:41 PM |
Print("Hi,I am UnStunned.") wait(1) else, m= Instance.new("Message",Workspace) m.Text="Hello" wait(5) m.Text="Welcome to my first game." wait(5)--Wait helps us in pausing the current action in a certain time limit. m:remove()
Like:- function OnTouch(UnStunned) local h=UnStunned.Parent:findFirstChild(Humanoid)--Humanoids are the stats that a robloxian has.Eg-Speed,Health,MaxHealth,Jump,Sit(Jump and sit are used with true and false) wait(10)--This is recognize your touch but will kill you after the 10 sec,not immediately if h~=nil then h.Health=0 end end
UnStun=script.Parent.Touched:connect(OnTouch)--This connects you to the function. --Hope this will help you. |
|
|
| Report Abuse |
|
|