Infinite yield possible?

Hi again… I added this variables to a local script

local LOWR =script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("LR")
local MEDR = script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("MR")
local HIGHR = script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("HR")
local CustomerTCH = script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("Coustumer")
´´´
And my code don't work now, I'll put all the code:
```lua
wait (3)

--Services

local Tween = game:GetService("TweenService")

--Player

local Player = game.Players.LocalPlayer

--Variables

local Sidebar = script.Parent:WaitForChild("Sidebar")

local Credits = script.Parent:WaitForChild("CreditsBar")

local Shop = script.Parent:WaitForChild("ShopBar")

local Teams = script.Parent:WaitForChild("TeamsBar")

local CloseC = Credits:WaitForChild("Back")

local CloseT = Teams:WaitForChild("Back")

local LOWR =script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("LR")

local MEDR = script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("MR")

local HIGHR = script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("HR")

local CustomerTCH = script.Parent:WaitForChild("TeamsBar").MainFrame:WaitForChild("Coustumer")

local CloseS = Shop:WaitForChild("Back")

local PlayB = Sidebar:WaitForChild("Play")

local CreditsB = Sidebar:WaitForChild("Creditsb")

local TeamsB = Sidebar:WaitForChild("Teamsb")

local ShopB = Sidebar:WaitForChild("Shopb")

local Tittle = Sidebar:WaitForChild("Tittle")

local MiniC = Sidebar:WaitForChild("Mini-Credits")

local Cam = workspace.CurrentCamera

local CamPoints = workspace:WaitForChild("Camera points")

local Cutscene = true

--Transictions

local SlideoutSlide = Tween:Create(Sidebar,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)}):Play()

local SlideInSide = Tween:Create(Sidebar, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = UDim2.new(-0.3, 0, 0, 0)})

local SlideInCredits = Tween:Create(Credits, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = UDim2.new(-0.3, 0, 0, 0)})

local SlideoutCredits = Tween:Create(Credits,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)})

local SlideInShop = Tween:Create(Shop, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = UDim2.new(-0.3, 0, 0, 0)})

local SlideoutShop = Tween:Create(Shop,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)})

local SlideInTeams = Tween:Create(Teams, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = UDim2.new(-0.3, 0, 0, 0)})

local SlideoutTeams = Tween:Create(Teams,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)})

-- Buttons

PlayB.MouseButton1Click:Connect(function()

SlideInSide:Play()

Cam.CameraType = Enum.CameraType.Custom

Cam.FieldOfView = 70

Cutscene = false

end)

CreditsB.MouseButton1Click:Connect(function()

SlideInSide:Play()

SlideoutCredits:Play()

end)

TeamsB.MouseButton1Click:Connect(function()

SlideInSide:Play()

SlideoutTeams:Play()

end)

ShopB.MouseButton1Click:Connect(function()

SlideInSide:Play()

SlideoutShop:Play()

end)

CloseC.MouseButton1Click:Connect(function()

SlideInCredits:Play()

Tween:Create(Sidebar,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)}):Play()

end)

CloseT.MouseButton1Click:Connect(function()

SlideInTeams:Play()

Tween:Create(Sidebar,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)}):Play()

end)

CloseS.MouseButton1Click:Connect(function()

SlideInShop:Play()

Tween:Create(Sidebar,TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{Position = UDim2.new(0,0,0,0)}):Play()

end)

-- Camera

local function TweenCameraPos(Point,Speed)

Tween:Create(Cam,TweenInfo.new(Speed,Enum.EasingStyle.Linear),{CFrame = Point.CFrame}): Play()

end

Cam.CameraType = Enum.CameraType.Scriptable

Cam.FieldOfView = 50

while Cutscene do

for i = 1, 4 do

if not Cutscene then break end

Cam.CFrame = CamPoints:FindFirstChild(tostring(i + i - 1)).CFrame

TweenCameraPos(CamPoints:FindFirstChild(tostring(i + i)),4)

wait(4)

end

end
´´´

Also an image of the output error: ![Anotación 2020-05-27 231337|690x56](upload://40oFZXflRgc0XVf784UYOSnyX3x.png)
1 Like

An infinite yield possible warning means…well…that most likely your yield is never ending because the child you’re attempting to search for isn’t existent.

The only advice I can offer you is to make sure your names are all correct to what the actual child’s name is that you’re searching for. And you could also check to make sure your parent hierarchy is all correct.

2 Likes

You could try using the second parameter of WaitForChild() which would be the minimum time it needs to wait for the child.

:WaitForChild(childName, time) basically the time would be the time it needs to keep on waiting until it moves to the next line

Most likely one of the variables was not found due to typo or any form of error in writing. The infinite yield might have returned a specific line in the console. Try checking the line and find out what object/child is non-existent(or typo).

1 Like