of     2   
chevron_rightchevron_rightchevron_right

MakeLotsOfMoney
#183105463Saturday, February 06, 2016 7:14 PM GMT

If the player leaves and another script is currently iterating through a descendant of the player, will the loop error, continue, or stop after the current iteration?
devHoodie
#183105857Saturday, February 06, 2016 7:20 PM GMT

It errors. Done it before. Nasty ROBLOX :( Though if it's a Local script that doesn't effect server it wouldn't really matter now would it? Unless the error is game breaking inside of a server script.. then no need to fix it ;p -- Former AKA : luis15232
C_Sharper
#183105876Saturday, February 06, 2016 7:20 PM GMT

pcall?
drgn42
#183105878Saturday, February 06, 2016 7:20 PM GMT

I would assume it will return an error.
C_Sharper
#183105940Saturday, February 06, 2016 7:21 PM GMT

local p = game.Players.LocalPlayer for i,v in pairs(p:GetChildren()) do if not p then break end end ???
devHoodie
#183105953Saturday, February 06, 2016 7:21 PM GMT

True! Use pcall and if it errors it'll just continue. -- Former AKA : luis15232
MakeLotsOfMoney
#183106233Saturday, February 06, 2016 7:26 PM GMT

That's kind of dumb. So I need to pcall so much. Ugh.
MakeLotsOfMoney
#183106280Saturday, February 06, 2016 7:27 PM GMT

"Unless the error is game breaking inside of a server script.. then no need to fix it ;p" Yeah but if the player leaves while the old tycoon data is being loaded or something, there's potential for errors in a number of places. Time to revert to good old pcall spam.
devHoodie
#183106541Saturday, February 06, 2016 7:31 PM GMT

@Make See that's game breaking c; -- Former AKA : luis15232
MakeLotsOfMoney
#183107171Saturday, February 06, 2016 7:43 PM GMT

"See that's game breaking c;" Yeah, at least I asked here. That type of error would prevent my game from getting on the front page.
TimeTicks
#183107275Saturday, February 06, 2016 7:45 PM GMT

Never use pcall. Ever.
MakeLotsOfMoney
#183107295Saturday, February 06, 2016 7:45 PM GMT

"Never use pcall. Ever." That's silly advice.
TimeTicks
#183107360Saturday, February 06, 2016 7:46 PM GMT

Not really. PCall hides errors you can fix. In the case of this simply, if not p then return end duh.
MakeLotsOfMoney
#183107407Saturday, February 06, 2016 7:47 PM GMT

I know what pcall does, I'm not new to scripting. Having 20 different FindFirstChild statements is silly in a lot of cases. Sometimes pcall does the job just right.
TimeTicks
#183107461Saturday, February 06, 2016 7:48 PM GMT

It's really bad practice. Doesn't matter what the application is.
MakeLotsOfMoney
#183107573Saturday, February 06, 2016 7:50 PM GMT

"It's really bad practice. Doesn't matter what the application is." Not necessarily. Is overusing pcall bad? Sure. Can you never ever use pcall? Nah, you can, just limit its use from getting out of hand.
C_Sharper
#183107806Saturday, February 06, 2016 7:55 PM GMT

'It hides your errors so you can't fix it' I swear it does show them.
MakeLotsOfMoney
#183108059Saturday, February 06, 2016 8:00 PM GMT

No pcall does hide errors.
C_Sharper
#183108175Saturday, February 06, 2016 8:03 PM GMT

Hmm. I thought I remembered a time I used a touched event with a pcall and it gave me an error.
LongKillKreations
#183108434Saturday, February 06, 2016 8:08 PM GMT

As long as you aren't yielding in the loop, you're fine.
MakeLotsOfMoney
#183108511Saturday, February 06, 2016 8:09 PM GMT

"As long as you aren't yielding in the loop, you're fine." Alright, you sure though?
128Gigabytes
#183108530Saturday, February 06, 2016 8:09 PM GMT

No it won't error and anyone who said it will didn't actually test it. The loop will finish, the only thing that has changed is the player instance is parented to nil.
morashsPeasant
#183108558Saturday, February 06, 2016 8:10 PM GMT

@128 how long before its destroyed?
128Gigabytes
#183108580Saturday, February 06, 2016 8:10 PM GMT

'As long as you aren't yielding in the loop, you're fine.' Not true, even with a yield, it will work fine, the only thing that has changed is the player instance is parented to nil.
MakeLotsOfMoney
#183108861Saturday, February 06, 2016 8:15 PM GMT

@128GB Oh, really? You're sure of this? I'll go test it in a second. That's great.

    of     2   
chevron_rightchevron_rightchevron_right