local function chooseRandom()
local randomPart = script.Parent.Plates:GetChildren()[math.random(1, #script.Parent.Plates:GetChildren())]
if randomPart.Transparency == 0 then
return randomPart
else
print("picking something else")
chooseRandom()
end
end
function test()
print("gives part is '".. chooseRandom().Name.. "'")
end
while task.wait(0.1) do
test()
end
okay so I have this little code just to show you what I’m talking about. In it in my theory test() should call a function which would repeatedly call itself if criteria isn’t reached. But for some reason even like that chooseRandom() or test() still picks something up even if criteria isn’t reached, which leads to errors
as you can see on the screenshot all the prints work but the error tells us that it for some reason gathered something from the function. Anyone can explain why? Or any workaround?
