My game experience has recently started ‘infinite yielding’ everything and giving the result to the output.
I have ZERO idea as to why this happened, it’s been happening ever since I launched studio one day.
There are ZERO issues in the code, as this started happening when i wasn’t doing even the slgihtest amount of coding (importing models)
This seriously starting to annoy me as there is no reason for this to happen.
i’ve tested this both in studio and the actual game, it happens in both
there’s no way a script located inside the character can run before the character fully loads, is there?
If this doesn’t affect gameplay itself, the WaitForChild() method can take a second argument (a number) that determines how many seconds have to pass before sending the warning. You can set this second argument to math.huge so it doesn’t flood the output!
this literally happens with instances that are currently on screen (vFists as an example)
it’s starting to annoy me and i’m starting to believe this is just a bug
local character = player.Character or player.CharacterAdded:Wait()
local gameplayValuesFolder: Folder = character:WaitForChild("GameplayValues")
gameplay values automatically gets created for the character everytime it spawns
Pretty sure this happens just to make you aware that if it doesn’t find a part, it’ll pause the script forever. To fix it, just shove a maximum wait duration as the second parameter, such as
local Part = script:WaitForChild("Part", 10) -- will only wait for 10 seconds.
I’ve had a similar issue, I solved it by turning off Streaming Enabled in the Workspace’s properties?
Also for most of your variables using :WaitForChild() isn’t needed, especially after you turn off Streaming Enabled, but that is IF turning off Streaming Enabled actually works.
local character = player.Character or player.CharacterAdded:Wait()
This doesn’t mean the character is fully loaded. In fact, it isn’t.
The player’s HumanoidDescription is still loading, and that takes a bit more time.
Deeper references in the hierarchy are not all loaded at this exact moment.
Almost every answer here says “wait longer”… have you tried waiting longer?
You also said “out of the blue” .. what did you just change?
You can use repeat task.wait to make the script wait for whatever your referencing is loaded in. repeat task.wait() until character:WaitForChild("GameplayValues")
Looks to me like your character is loading multiple times. I think this because you will only get 1 infinite yield warning but your game says (x2).
Since you have everything under the character, you will have a new script every time you respawn. And if it starts waiting for the rootpart then gets destroyed I’m not sure if that cancels the yield.
Do you have a custom spawning system? If you do then I’m sure the problem is there.
If not then:
Does this happen when you publish and try the game on roblox?
Does the game still work despite these warnings?
Is there any way your character could be falling/dying/being destroyed when they first spawn in?
You said the only thing you were doing was animations.
Did you copy the players character while playing then pasted it into studio? I could imagine you did this because it’s an easy way to get the rig with the gun model already welded by a script. If so then delete all scripts from your animation rigs.
um Im pretty sure this is exactly what WaitForChild does . . . it waits for the referenced thing to load in. Like if you were to actually test it, this loop would only run once as the WaitForChild would yield it, theres no point in the repeat loop
unless theres something Im missing ofc
if you did want to use the repeat loop you should use FindFirstChild instead:
repeat task.wait() until Object:FindFirstChild('ChildName')
ofc this is the exact same thing as just using WaitForChild,
This would be so much easier if we could see the script and a picture of the hierarchy.
WaitForChild() is one of the easiest errors to fix. Most of the time it’s a spelling error or a timing error.
With nothing to work with you’ll just get speculation..
no, it was nothing related to the character, it was viewmodel animations
yeah, but the issue didn’t exist until recently, and i haven’t touched the spawning code in ages
i AM, i literally AM
i set the timeout to like 30 seconds and it STILL doesn’t find anything
i’ve said this so many times already :((
the issue appeared when i wasn’t even coding, i wasn’t editing any hierarchies or anything, i was just adding new viewmodels
funnily enough, i get an infinite yield that doesn’t even point to a script: