Currently this only checks one block and doesn't check the rest of them, how can I fix that?
for i,v in pairs(model:GetChildren()) do if v:IsA("Part") then while wait(1) do if player:DistanceFromCharacter(v.Position) <= 20 then print('near'); else print('not near'); end end end end-
It only prints 'near' when you get near only one block in the model, and yes the bricks are spread out past 20.
The problem is that a while loop like the one you have repeats infinitely - it never stops, so it never gets past the first part.
print("Hello") while wait() do end print("world!") -->> this doesn't print because the loop is infinite
The way I think you'd want it to run would be:
while wait(1) do for i,v in pairs (model:GetChildren()) do -- code end end
Hope I helped!
~TDP