This creates and infinite yield and I don't know how to fix it.

groupId = 3205396

function onClicked(ply)
	
    	script.Parent.BrickColor = BrickColor.new("Lime green")
		game.Players[ply.Name]:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("success"):TweenPosition(UDim2.new(0, 0,0, 0), 'Out', 'Bounce')
		wait(1)
		game.Players[ply.Name]:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("success"):TweenPosition(UDim2.new(0, 0,1.7, 0), 'Out', 'Bounce')
		script.Parent.BrickColor = BrickColor.new("Really red")
		
	for i,v in pairs(game:GetService("Players"):GetPlayers()) do	
	
		if v:GetRankInGroup(groupId) >= 6 then	

			game.Players[ply.Name]:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("notification"):WaitForChild("notilabl"):TweenPosition(UDim2.new(0, 0,0, 700), 'Out', 'Bounce')
			game.Players[ply.Name]:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("notification"):WaitForChild("notilabl").Text = ply.Name .. " has asked for your appearance at the front desk."
			wait(3)
			game.Players[ply.Name]:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("notification"):WaitForChild("notilabl"):TweenPosition(UDim2.new(0, 0,1.7, 700), 'Out', 'Bounce')
		
		end
		
	end

end
 
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

2 comments

1

Try adding prints in between certain sections of the code and check the Output for any warnings; might be possible that there may have been a spelling error in here somewhere.

0

it says Infinite Yield wait for child screengui