Infinite yield problem?

Hi, so I’m making a script for a stand where it punches and I was following a tutorial on YouTube since im pretty bad at scripting. So i follow it word for word and for whatever reason whenever i try and punch these 2 messages always appear:

So that’s quite confusing, so here’s the local script:



image

And then here’s the server script:




So i’m not sure if anyone has been following the tutorial and had the same problem but i cant figure out how to fix this problem for the life of me, so if anyone could give suggestions on how i can fix this bearing in mind im pretty much a beginner in scripting (hence why im using a tutorial) that would be great.

Thanks :slight_smile:

It just means that it could potentially wait an unreasonable amount of time before finding the child, it’s simply a warning. I read somewhere that it generally gives this warning, if it can’t find the child after 5 seconds.

If you want to get rid of it, just add a timeout:
:WaitForChild("Stand", 50)

Ok thanks, I’ve just tried that and it seems to get rid of that problem but this pops up,
image
Which im assuming is nothing to do with that timer but i dont quite get what’s going wrong there since ive never seen those errors in my life

Line 21: it should be UID.InputBegan:Connect

Line 13 in the server script: Separate the WaitForChild statement and the Clone()

local Stand = script:WaitForChild("Stand", 50)
local StandClone = Stand:Clone()

So the first one worked the UID isn’t a problem anymore but the others are
image
I separated the clone but it just pops up again and now there’s something wrong with line 45 :confused:
Sorry for all the problems

Well the error at line 14 essentially means that it could not find “Stand” so the variable Stand is nil and you can’t Clone a non existent object.

Try:
script.Parent:WaitForChild("Stand", 50)

And you’ve used the remote event wrong, you’re trying to fire it and run a onClientEvent in the same script. You need to run Punch:FireClient(player) in a server script.

Are you sure there’s something called Stand in ServerScriptService and something called Punch in ReplicatedStorage?

This error means that it cannot find the child, therefore, there’s a possibility that the script is waiting forever/for a very long time.

Adding a time to stop looking for (such as script.Parent:WaitForChild(“Stand”, 50), 50 seconds), won’t help if the object does not exist. The script will fail somewhere else when trying to do operations on nil.

Well i’ve just changed the remote event to punch instead of punching however the stand is actually in the summon script, and that makes it work
image
So do i have to move it into the actual server script service?

Does that fix the issue?

Try to playtest, and view from the server. Is the Stand Model still in there while playtesting?

Well changing the Punching to Punch seems to have gotten rid of an error however ive still got this error


So i might try put the stand just in server script since i cant see anything in server script when i run it

Just tried it and it mucks up the summon :confused:

It’s because it can’t find Stand, you need to use the correct path.

I suggest just putting Stand in ServerStorage and using

local Stand  = game.ServerStorage:WaitForChild("Stand")

Ok so where abouts do i put that line of script because by putting the stand in server scropt it then doesnt summon the stand anymore

Enter the server, you can’t view things from ServerScriptService in client.
If that’s what you were doing in the first place, then place it somewhere else.

Here you’ve mentioned that this is a server script, which means Stand should be found.


Also, as I mentioned before, you’re getting the GetChildren() problem because “Stand” is not found, which means it can’t get the children of something that the script thinks does not exist.

Did you try to re-start studio? I sometimes get problems with :WaitForChild that are solved on restart.

It doesn’t summon because it can’t find it in the first place