I am trying to learn magnitude and I'm very new to it. If so, where should I begin?
Here's a quick script I wrote to help you understand magnitude.
local PlayerObject = game.Players:WaitForChild("PlayerName") --//Change PlayerName to the name of the specific player you want repeat wait() until PlayerObject.Character ~= nil --//Making sure the player's character isn't nil when we set the CharacterObject variable local CharacterObject = PlayerObject.Character local FoundPlayer, Closest = nil, math.huge --//Setting the variables that will help us find the closest other player for _, v in pairs(game.Players:GetPlayers()) do --//Gotta loop through the players if (v ~= PlayerObject and v.Character) then --//Making sure that the player we're looping through is not the player we specified, otherwise it would cause a bug local Distance = (CharacterObject.PrimaryPart.Position - v.Character.PrimaryPart.Position).Magnitude --//To get the distance between two parts, you get the difference of their positions and call the magnitude property on the new vector if (Distance <= Closest) then --//Checking to see if the closest is more than the distance we calculated, if it is we have a new closest --//Just updating the closest value and the FoundPlayer value incase this is the closest player we could find Closest = Distance FoundPlayer = v end end end --//Just printing out the closest player's name if (FoundPlayer) then print("The closest player was " .. FoundPlayer.Name .. " at " .. Closest .. " studs away!") end