I have a script that uses a remote event to take the name of a player and the team the player wants to join to, in the server script it receives this and is meant to change the player to that team and add 1 to the value in the ui, I managed to get the player and team from the remote event but when I try to find the ImageButton I get the infinite yield error for “WaitForChild”, why can’t the game find it?
local nt = game.ReplicatedStorage:WaitForChild("NewTeam")
local StarterGui = game:FindService("StarterGui")
local Menu = StarterGui:WaitForChild("Menu")
nt.OnServerEvent:Connect(function(Team, player)
print(Team)
print(player)
local TeamNum = Menu:WaitForChild(Team)
local Count = TeamNum:WaitForChild("Value")
Count.Value = Count.Value+1
player.Team = game.Teams:FindFirstChild(Team.Name)
end)