Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a specific action trigger a for loop?

for _, child in pairs(workspace.Ruins.RedCastleRuin:GetChildren()) do
			if child:IsA("Part") then
				for i = BricksToWin, 1, 1000 do
					child.Changed:Connect(function()
						print("Destroyed")
					end)
				end
			end
		end
	

I want the inner for loop to only count whenever the child.Changed event runs

2 comments

0

I would say to change the for loop to a while loop, that way you can choose when you want to increment the value instead of incrementing every single time

0

ok thx

1 answer

For the context here, you don't need a loop, use intvalue

This discussion is preserved as it was. New answers, comments, and votes are closed.