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

Script unable to locate a Gui? ("Infinite yield possible")

Asked by 7 years ago
Edited 7 years ago

This is part of a more complex team changing script. When a player clicks a TextButton, the local script inside of it fires a remote event in the workspace. The remote event then executes the server script. In studio solo mode, it all works out and the player changes teams. However, when the player attempts to change teams in online mode, the following error is presented:

Infinite yield possible on "Players.Player.PlayerGui:WaitForChild("MainInterface") Script 'Workspace.Handler', Line 2 Stack End

Server script:

script.Team.OnServerEvent:connect(function(player)
        for i,child in pairs(player.PlayerGui.MainInterface.Start.Menu.Main.Team:GetChildren()) do
    if child:IsA("StringValue") then
        script.teams:FindFirstChild(child.Value):Clone().Parent = game.Teams
        player.TeamColor = script.teams:FindFirstChild(child.Value).TeamColor
        player.Character:BreakJoints()
    end
end 
end)

Just to test and see if another script in the game somehow changed the name of MainInterface, I put a simple loop inside of MainInterface that prints its name of every 5 seconds. The name remained the same. I'm sure it's a super simple solution, and I'd appreciate any help/suggestions.

Thanks!

0
Is this the wrong script? User#11440 120 — 7y
0
No, this is the server script. Inside of it is the remote event, named "Team". Also inside is a folder with a bunch of teams. Judging by the error, I didn't think it was necessary for me to add the local script. AmericanDev 10 — 7y

Answer this question