I have multiple numbers in my table. I want to get the smallest number. How can I do this?

I have this table
local MagnitudeList = {}
When there is a target in the table, it gets added with Magnitude with this script:

for Target, Value in pairs(TargetList) do
	table.insert(MagnitudeList, (Target.HumanoidRootPart.Position - script.Parent.Actor.PrimaryPart.Position).Magnitude)
	print((Target.HumanoidRootPart.Position - script.Parent.Actor.PrimaryPart.Position).Magnitude)

How can I sort everything in the table from smallest to greatest?

Thanks in advance!

You can use table.sort() table | Roblox Creator Documentation

local tab = {}
      return magA < magB

You don’t need to include the sort behavior because that’s the default.

table.sort(tab) does the same.