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

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

Asked by 4 years ago
Edited 4 years ago

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)

1
First, fix your code block. Second, do you parent the animations to your script from another script? SteamG00B 1633 — 4y
0
We really can't help you if you refuse to give us anymore information. SteamG00B 1633 — 4y
1
I don’t really know why you would store things other than scripts in serverscriptservice. You should store them in server storage DarkDanny04 407 — 4y

1 answer

Log in to vote
0
Answered by
ImTrev 344 Moderation Voter
4 years ago
Edited 4 years ago

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.

0
That is not a working link. SteamG00B 1633 — 4y
0
When i test the crawling, it wont make me crawl julienblox123b 2 — 4y
Ad

Answer this question