Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Whats Infinite yield possible on 'ReplicatedStorage:WaitForChild?

Hey, When i run this code it gives this errror: Infinite yield possible on 'ReplicatedStorage:WaitForChild("Remote")'. Does anyone know what this is?

wait(2)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")

local function RemoteSmall()
    GetWood = false
    WC = plr.PlayerGui.WoodChopper
    WC.BG.Visible = true
    char.Humanoid.WalkSpeed = 0
    char.Humanoid.JumpPower = 0
    animation:Play()
    ShowProgress('SmallTree1')
    animation:Stop()
    char.Humanoid.WalkSpeed = 16
    char.Humanoid.JumpPower = 50
	
end

	
Remote.OnClientEvent:Connect(RemoteSmall)

1 answer

✓ Accepted answer

I am sure that it isn't an error but a warning RBLX:WaitForChild() yields the thread(the script) until it finds the Remote, it warns you because "Remote" might not ever exist and thus the code below it might never execute/run. Try creating the remote above it or add it manually in studio.

9 comments

0

Hey, I cant get it to work... could you maybe explain it a bit more?

0

WaitForChild() takes two arguments. The first one is the instance, the second is the timeout. Basically it's just warning you that there is no timeout, so it could be waiting for the instance forever.

0

What do i need to add so it can find it? Is it a remote event? Im trying understand this page: https://developer.roblox.com/api-reference/function/RemoteEvent/FireClient

0

Don't worry about it, just make sure that there is a remote

0

But is doesnt work :(

0

add a RemoteEvent in ReplicatedStorage and name it "Remote"

0

Thanks, the warning is gone! The thing still does not work...

0

If you need help with making it work, you should probably make another question

0

Not a good idea to make another question, as that's spam and is against the rules... Think next time.

This discussion is preserved as it was. New answers, comments, and votes are closed.