How would i get all players and use player distance?

The title basically says it all lol

local Player game.Players:GetPlayers()
	while true do 
		wait()
		local Distance = Player:DistanceFromCharacter(game.Workspace.TowerHitbox.Position)
1 Like
local Players = game:GetService("Players")

while true do
	wait()
	for _, player in pairs(Players:GetPlayers()) do
		local distance = player:DistanceFromCharacter(workspace.TowerHitbox.Position)
		--Rest of the code needed
	end
end

You could also substitute wait() with game:GetService("RunService").Heartbeat:Wait() if you want it to ensure it fires per frame