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!