while true do
wait()
player.PlayerGui.ScreenGui.TextLabel.Text = "You are standing next to nobody"
for i, v in pairs(game.Players:GetPlayers())do
local magnitude = (player.Character.Head.Position - v.Character.Head.Position).magnitude
if magnitude < 10 and v.Name ~= player.Name and player.Character and v.Character and head then
player.PlayerGui.ScreenGui.TextLabel.Text = "You are standing next to "..v.Name
end
end
end
This will still only pick ONE of the Player within 10 studs. You will have to make more TextLabels, or create another list, and add every close player to that list, then write another loop after this to print out list. |