Infinty Infinty yield

everything works perfectly but just sometimes some products wont work im going to test game and buyying a product and its works and when i pause it and start again it wont work so what should i do

You should change that to FindFirstChild, WaitForChild yields the thread and gives a warning if it cannot find the child.

1 Like

all wait WaitForChild’s to FindFirstChild ?

No, I’m referring to this:


Yes, on this line, change it to FindFirstChild and you won’t get anymore warnings

okay there 8x this line on game so you mean in this line i will change WaitForChild to FindFirstChild right ?

Thank you so much it works now

It works ok but now droppers wont work. Bro… When i buy first dropper second one not coming in Tycoon game.

It’s just removing the yields but game stops working

That’s because it needs to yield to wait for the objects to exist.

but it causes problem on products… i need fix it but if i make it FindFirstChild the game wont work… how can i fix it correctly.

Think of it logically, if they haven’t been bought then you shouldn’t be waiting for them?

what do you suggest me to do… I’m not scripter that’s why im waiting for someone tell me the fixed area

I suggest that next time you script, condense it down . You could have easily transferred this into a module script then call the functions. This makes it easier to debug.

can i just make it like this ? if i make it like that everything works and it wont for infinty … just 170 years xd image

Yes, you could just do that it just wouldn’t be the best solution but it works. If you just want to get rid of the warning then so be it.

omg wow i’m really suprised idk how i found this haha but everything works perfect now thanks

Yes, the second parameter is the limit of how long it can yield for, but it’s unlikely the player will stay for 90000000 seconds.

yeah thats why i made it 90000000 right ? first i tried it 5 second in i got argument missing error so i made it 90000000 now it works ? it wont make error in future right ?

Yes it won’t make an error because the player would have left in those many seconds.

1 Like

It means the instance didnt load