Many scripts don’t need to start the moment the game starts. I find it very useful to add a task.wait(3) to the top of most scripts. This has a few benefits, one being a nice smooth fast game load. 2nd being the program has time to skip warning like this. Still use the waitforchild() however … gl
Don’t do this, this is a recipe for hard-to-diagnose race conditions. Waiting for an arbitrary amount of time in order to fixing poorly-coded loading scripts is classic Roblox code smell.
Use it all the time on scripts that don’t need to load right off the bat … even my biggest games load in 3 seconds or less. Never had a problem with this myself.
It’s not that my script are written poorly … they work either way. But this will for sure make your load time faster.
I’ve been programming for 4 decades. Time management is simple. I know what scripts to do this on and what ones to not … I wouldn’t have said it if I wasn’t 100% sure it works.
It actually worked! But there’s another error that i had even before, when i step on the EnterShop part, it doesn’t make my shop Menu (or Frame) visible. But in the properties it says it’s visible but in-game it is invisible.
This is just a small stall … it’s not a fix all. As for the menu you may not have it set up right to see in the 1st place. idk … pull it out of the program and test it on a different one. I would have to look at it to say for sure what’s going on.
But the OP does not. You’ve recommended adding arbitrary wait to a script you know nothing about the context of, like it’s a magic fix that will work anywhere.
What I’m saying is that if a new coder “fixes” their scripts by putting a wait(3) at the top, it allows them to write bad code anywhere below this that doesn’t have the correct yielding behavior, and just works “most of the time”… until in the live game something takes 3.1+ seconds to replicate, then it all comes crashing down.
Adding a task.wait is completely unnecessary. This “Infinite yield” warning shouldn’t affect your game at all. Anyway, the other problem likely has to do with client-server replication. You should use a RemoteEvent to tell the client to open the menu.
Edit: the facepalm wasn’t directed at you, @KCapre_Dev
It’s not a fix all … as I just said. what it is, is a moment of letting everything load fully before you start working with it via script.
I’ve never seen a infinite yield possible … what kind of of an error message is that … lol
You missed it or you didn’t …
As for the wait like I said I use that all the time in most every language I use.
Sometime you use things that take up a ton or processer time. Like land creation. I’d rather give it the time to breath than slam it all in at the same time.
Ya I know that, just seems like an odd warning … Must have came from some other script that refenced it before the waitforchild() had time to access it… then passed once it was accessed by the 1st script. Glad he got it working either way. Like possibly the GUI that is not working … Put a wait on that too
“Infinite yield possible” is a warning that’s generated anytime WaitForChild() called with no max time limit has been waiting for 5 seconds. It’s not an indicator of whether or not the thing you’re waiting for will actually load, more of a heads up to let you know there might be an issue.