generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Anyone here understand coroutine.wrap?

Previous Thread :: Next Thread 
cole7778 is not online. cole7778
Joined: 19 Nov 2009
Total Posts: 7827
18 Sep 2014 11:24 PM
I just can't get it to work. Someone told me to use it to check for multiple things all at once. Can someone tell me what im doing wrong? There is no output.

function EveryoneDies()
if #players <= 0 then
end end

function TimeRunsOut()
script.Time.Value = 0
end

function PeopleKillABoss()
bosshealth = 0
end

while wait() do
if EveryoneDiedCondition then
ED = coroutine.wrap(EveryoneDied);ED();
script.Parent:Destroy()
game.ServerScriptService.RoundReady.Value = true

elseif TimeRunsOutCondition then
TRO = coroutine.wrap(TimeRunsOut);TRO();
script.Parent:Destroy()
game.ServerScriptService.RoundReady.Value = true

elseif PeopleKillABossCondition then
PKAB = coroutine.wrap(PeopleKillABoss);PKAB();
script.Parent:Destroy()
game.ServerScriptService.RoundReady.Value = true

Report Abuse
cole7778 is not online. cole7778
Joined: 19 Nov 2009
Total Posts: 7827
19 Sep 2014 12:01 PM
no?

d00d
Report Abuse
GiganticGulian is not online. GiganticGulian
Joined: 18 Feb 2011
Total Posts: 2233
19 Sep 2014 01:09 PM
why don't you use coroutine.wrap(function)()

anyway, if you're working with alot of if statements and there's no output, whilst it isnt doing what it is supposed
try running it with alot of prints so you can see where it exactly stops and fix that if statement that would block stuff to be done correctly
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
19 Sep 2014 01:15 PM
If you want to check for multiple things at once, just use and in the condition.
Like, if a==2 and b and not c then just checks for all of those conditions being true. If you need just one of them to be true, use or instead.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image