Interact System Effeciency
Hello! I’m RazorBladedino117, a scripter. I’ve scripted many interact systems throughout my years on roblox, but I’ve had a question from the beginning. During all my interact systems, I use a similiar bit of code as shown below:
local minimum_distance = 20 for _, entity in pairs(interact_list) do local magnitude = (entity.Position - root.Position).Magnitude if magnitude < minimum_distance then minimum_distance = magnitude interact_object = entity end end
Do you think there is a more efficient way to run through the list and detect the
interact_object ? Please comment your ideas below!