Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why am I getting an Infinite yield warning for requiring a module?

Asked by
tjtorin 172
6 years ago

Everytime I start the game I get a warning saying Infinite yield possible on 'ServerScriptService:WaitForChild("MathModule")'

m = require(game:GetService("ServerScriptService"):WaitForChild("MathModule"))
local plr = game:GetService("Players").LocalPlayer
while wait(2) do
    local cLevel = plr.leaderstats.Level.Value
    local cEXP = plr.leaderstats.EXP.Value
    local NLEXP = m.nextLevel(cLevel + 1)
    local nEXP = NLEXP - cEXP
    script.Parent.Text = "EXP to next level: "..nEXP
end
0
Put the MathModule in Workspace. yHasteeD 1819 — 6y
0
that did not work I still got the same message tjtorin 172 — 6y
0
It also works in another script just not this one tjtorin 172 — 6y
0
try to put a wait(1) in the first line of script, and remove the :WaitForChild. yHasteeD 1819 — 6y
View all comments (5 more)
0
and be sure to see if the location is correct. yHasteeD 1819 — 6y
0
I get tons of these warnings too. Should I try to get rid of them or are they just harmless notifications? OBenjOne 190 — 6y
0
And no don't try the wait(1) method or it will give you an error OBenjOne 190 — 6y
0
Errors are worse than warnings OBenjOne 190 — 6y
0
Look at my answer. It's only a warning because it's saying it's been multiple seconds and the child wasn't found. The reason the wait(1) method just shows an error is because the child isn't there. Knineteen19 307 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

"Infinite yield possible," is just saying that it has been multiple seconds, and the child hasn't been found yet. It might be that you made a typo somewhere when you were naming the "MathModule," or it might be that you referenced the wrong parent, and the child does not exist. Also, I think "ServerScriptService," doesn't exist when the game is actually running. Since it's probably a local script, you might have to do something creative with remote events to send something to a non-local script that has the same parent as the "MathModule" and do . . .

local mathModule = script.Parent:WaitForChild("MathModule")

To be honest, the easiest way would be to change the parent of the "MathModule" to something other than ServerScriptService if possible.

0
By the way, I'm not entirely sure that ServerScriptService doesn't exist after the game starts, but from my experience, all of the stuff in it is moved somewhere that I don't know. Knineteen19 307 — 6y
Ad

Answer this question