ForeverDev

Untitled

Nov 2nd, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. repeat wait() until game.Players.LocalPlayer.Character
  2.  
  3. local NODE_SIZE = 1
  4.  
  5. local player = game.Players.LocalPlayer
  6. local character = player.Character
  7.  
  8. local nodes = script.Parent:WaitForChild("Nodes")
  9. local node = {}
  10.  
  11. local deb = false
  12.  
  13. function attr(objects, properties)
  14.     objects = type(objects) == "table" and objects or {objects}
  15.     for _, v in ipairs(objects) do
  16.         for key, value in pairs(properties) do
  17.             v[key] = value
  18.         end
  19.     end
  20.     return unpack(objects)
  21. end
  22.  
  23. function round(n, mult)
  24.     return math.floor((n + mult/2)/mult) * mult
  25. end
  26.  
  27. function findPosColor(position)
  28.     local ray = Ray.new(Vector3.new(position.X, 100, position.Z), (position - Vector3.new(position.X, 100, position.Z)).unit * 500)
  29.     local part = Workspace:FindPartOnRay(ray, character)
  30.     if part then
  31.         return Color3.new(part.BrickColor.Color.r, part.BrickColor.Color.g, part.BrickColor.Color.b)
  32.     end
  33.     return Color3.new(1, 1, 1)
  34. end
  35.  
  36. for i = -75, 75, NODE_SIZE do
  37.     node[i] = {}
  38. end
  39.  
  40. for y = -75, 75, NODE_SIZE do
  41.     for x = -75, 75, NODE_SIZE do
  42.         node[x][y] = attr(Instance.new("Frame", nodes), {
  43.             Size = UDim2.new(0, NODE_SIZE, 0, NODE_SIZE),
  44.             Position = UDim2.new(0, x + 75, 0, y + 75),
  45.             BorderSizePixel = 0,
  46.             ZIndex = 3
  47.         })
  48.     end
  49. end
  50.  
  51. local progress = attr(Instance.new("Frame", nodes), {
  52.     Size = UDim2.new(0, 2, 0, 150),
  53.     BackgroundColor3 = Color3.new(0.6, 1, 0.6),
  54.     ZIndex = 4,
  55. })
  56.  
  57. function scan()
  58.     local ticks = 0
  59.     local benchX, benchY = character.Torso.Position.X, character.Torso.Position.Z
  60.     for x = -75, 75, NODE_SIZE do
  61.         ticks = ticks + 1
  62.         if ticks % 2 == 0 then
  63.             wait()
  64.         end
  65.         progress.Position = UDim2.new(0, x + 75, 0, 0)
  66.         for y = -75, 75, NODE_SIZE do
  67.             node[x][y].BackgroundColor3 = findPosColor(Vector3.new(round(benchX, NODE_SIZE) + (x + (NODE_SIZE / 2)), -10, round(benchY, NODE_SIZE) + (y + (NODE_SIZE / 2))))
  68.         end
  69.     end
  70.     scan()
  71. end
  72.  
  73. scan()
Advertisement
Add Comment
Please, Sign In to add comment