--[[			
	@param 	Number 		Range			The radius for which we will search for players (characters).
--]]

function Ownership:WaitForPlayerInRange(Range)
	-- Check if there are actually players in game - if not, wait for a player to join
	if #Players:GetPlayers() == 0 then 
		Players.PlayerAdded:Wait() 
	end
	
	local Player;
	repeat
		for _, player in pairs(Players:GetPlayers()) do
			if player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
				if (player.Character.HumanoidRootPart.Position - self.Model.PrimaryPart.Position).Magnitude <= Range then
					Player = player
					break
				end
			end
		end
		wait(0.1)
	until Player or #Players:GetPlayers() == 0
	-- The loop waits until either a Player has been found or there are no more players left in the game.
	
	-- If no player was found, it means the other condition (no players in game) was triggered.
	if not Player then
		-- We (re-)call this method to make use of PlayerAdded:Wait() instead of a repeat-loop, for efficiency.
		self:WaitForPlayerInRange(Range)
	else
		self:SetOwner(Player)
	end
end
