|
| 17 Sep 2011 05:02 PM |
| is there a way to run a while loop and have a .chatted event work in the same script? |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 05:15 PM |
Coroutines or delay()
http://wiki.roblox.com/index.php/Floodcheck_%28Hates_you%29 |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 05:24 PM |
so how would i incorporate coroutines into a script like this? (just an example)
while wait() do print("St00f") end
game.Players.Player.Chatted:connect(function(msg) if msg == "lol" then print("lol") end end) |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 17 Sep 2011 05:28 PM |
thanx 4 script
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 05:29 PM |
I'd rather use delay()
function Loop() while wait() do print("St00f") end end
game.Players.Player.Chatted:connect(function(msg) delay(0, Loop()) if msg == "lol" then print("lol") end end)
http://wiki.roblox.com/index.php/Floodcheck_%28Hates_you%29 |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Sep 2011 06:17 PM |
"delay(0"
WHAT ARE YOU DOING???? |
|
|
| Report Abuse |
|
|
GoldenUrg
|
  |
| Joined: 23 Aug 2009 |
| Total Posts: 6428 |
|
|
| 17 Sep 2011 08:20 PM |
delay(0,
is
Spawn(
However, you need to do:
delay(0,Loop) -- no () after Loop
otherwise, you'll call the function in the current thread and never get to anything else (like the error in the delay).
|
|
|
| Report Abuse |
|
|
GoldenUrg
|
  |
| Joined: 23 Aug 2009 |
| Total Posts: 6428 |
|
|
| 17 Sep 2011 08:22 PM |
Of course the original script doesn't need that:
game.Players.Player.Chatted:connect(function(msg) if msg == "lol" then print("lol") end end)
-- put the loop at the end while wait() do print("St00f") end
|
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 08:38 PM |
| thanks for clearing that up :P |
|
|
| Report Abuse |
|
|