Hello I have a function that I want to simplify.
local function GetClosestShop() local Distance = 6 local Closest = nil for Index,Shop in pairs(ShopData) do local newDistance = LocalPlayer:DistanceFromCharacter(FunctionParts[Index].Position) if newDistance <= Distance then Closest = Shop end end return Closest end
I think I should use math.min.
Is that possible?
I took me some time to make this one but I’m happy to make it smaller.