Advertisement
grannybat

script

Mar 12th, 2022
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. while true do
  2.    
  3.     task.wait()
  4.    
  5.     function cool(pos)
  6.        
  7.         local lowest = 30
  8.         local playerthatisnear
  9.  
  10.         for _, v in pairs(game:GetService("Players"):GetPlayers()) do
  11.            
  12.             if v and v.Character then
  13.                
  14.                 local distance = v:DistanceFromCharacter(pos)
  15.                
  16.                 if distance < lowest then
  17.                    
  18.                     lowest = distance
  19.                     playerthatisnear = v
  20.                    
  21.                 end
  22.                
  23.             end
  24.            
  25.         end
  26.        
  27.         --return playerthatisnear
  28.        
  29.         if playerthatisnear then
  30.            
  31.             print(playerthatisnear)
  32.            
  33.         end
  34.        
  35.     end
  36.    
  37.     cool(script.Parent.Position)
  38.    
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement