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

Infinite yield possible on 'ServerScriptService.CrawlServer:WaitForChild("CrawlIdle")' ?

What does this mean??

Script: local rStorage = game:GetService("ReplicatedStorage") local rEvents = rStorage:WaitForChild("RemoteEvents")

game.Players.PlayerAdded:Connect(function(plr) local crawlValue = Instance.new("BoolValue",plr) crawlValue.Value = false crawlValue.Name = "CrawlEnabled"

local char = workspace:WaitForChild(plr.Name)
local human = char:WaitForChild("Humanoid")

local idleLoaded = human:LoadAnimation(script:WaitForChild("CrawlIdle"))
local moveLoaded = human:LoadAnimation(script:WaitForChild("CrawlMove"))

human.Running:Connect(function(speed)
    if speed > 0 and crawlValue.Value == true then
        moveLoaded:Play()
    else
        moveLoaded:Stop()
    end
end)

crawlValue:GetPropertyChangedSignal("Value"):Connect(function()
    if crawlValue.Value == true then
        human.WalkSpeed = 8
       
        idleLoaded:Play()
    else
        human.WalkSpeed = 16
       
        idleLoaded:Stop()
        moveLoaded:Stop()
    end
end)

end)

rEvents.CrawlEvent.OnServerEvent:Connect(function(plr,enabled) local crawlValue = plr:WaitForChild("CrawlEnabled")

crawlValue.Value = enabled

end)

3 comments

1

First, fix your code block. Second, do you parent the animations to your script from another script?

0

We really can't help you if you refuse to give us anymore information.

1

I don’t really know why you would store things other than scripts in serverscriptservice. You should store them in server storage

1 answer

Credits to Monsieur_Robert for the answer His Answer

"Essentially all this means is that ROBLOX is warning you that your script can potentially wait forever, if the object you set to wait for hasn't been made.

You shouldn't have a problem with it (and it is just a warning, not an error), but if you want to get rid of the error, set a time where if the object is not created, the WaitForChild will just return nil and end"

EDIT: Sorry for the non-working link. I don't know how to link things.

2 comments

0

That is not a working link.

0

When i test the crawling, it wont make me crawl

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