for i,v in pairs(game.Workspace.GameObjects.Interactables:GetChildren()) do if v.IsA == ("Model") then 
		
		repeat

			wait(.1)

				if (HumRootPart.Position - v.InteractionPart.Position).magnitude < 15 then
					print("close")
				else
					print("far")
				end

		until false

	end
	
end

InteractionPart is a part inside every model in Interactables (folder)

HumRootPart is the player's humanoidrootpart

It works but only for one single model inside of the folder, the rest is ignored, idk how to get it to check if its close to any of them

3 comments

0

You're not adding an event to the models, you're just checking and then continuing if the player isnt close. You're also using a while loop inside a repeat loop which is not good practice.

0

The while loop is causing the for loop to stop, since the parameter is wait(), and you never break the loop.

0

i replaced the while loop with a regular wait(.1), but idk what u mean by not adding an event since im not experienced in this area