The gui script runs only once

The gui script is in trouble. Due to the structure, for has to come
“for” is first time, is there any way to repeat it infinitely?

script is this

for i,  x in pairs(script.Parent.scr:GetChildren())  do
	if x:IsA("Frame") then
	  if x:FindFirstChild('TextButton') then
			x.TextButton.MouseButton1Click:Connect(function()
				local r = game.ReplicatedStorage.bomb.skin.sellb:Clone()
				
				r.MouseButton1Click:Connect(function()
					
					return
				end)
			end)
	   end
	end
end

Just put everything in a while wait() do. This will repeatedly loop and wait() so it wouldn’t crash the script.

while wait() do
-- put everything here
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.