Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. while game.CoreGui:FindFirstChild("Logger") do
  2. game.CoreGui.Logger:Destroy()
  3. wait(0.1)
  4. end
  5. wait(1)
  6. local arg = Instance.new("ScreenGui", game.CoreGui)
  7. arg.Name = "Logger"
  8. local gr = Instance.new("TextLabel", arg)
  9. gr.Name = "LogLabel"
  10. gr.BackgroundTransparency = 0.9
  11. gr.TextWrapped = true
  12. gr.TextColor3 = Color3.new(0, 1, 0)
  13. gr.Active = false
  14. gr.Text = ""
  15. gr.Size = UDim2.new(0.5, 0, 1, 0)
  16. gr.Position = UDim2.new(0.5, 0, 0, 0)
  17.  
  18. local function log(m)
  19. gr.Text = gr.Text .. " " .. m
  20. end
  21.  
  22. local function track(p)
  23. local bg = Instance.new("BillboardGui", game.CoreGui)
  24. bg.AlwaysOnTop = true
  25. bg.Size = UDim2.new(1, 0, 1, 0)
  26. bg.Adornee = p
  27. local t = Instance.new("TextLabel", bg)
  28. t.Size = UDim2.new(1, 0, 1, 0)
  29. t.Text = "test"
  30. t.BackgroundTransparency = 1
  31. t.TextColor3 = Color3.new(1, 0, 0)
  32. return t
  33. end
  34.  
  35. log("test")
  36.  
  37. local cam = workspace.CurrentCamera
  38.  
  39. local cache = { }
  40. local function setup()
  41. for i, v in next, workspace:GetDescendants() do
  42. if v.ClassName == "ClickDetector" and v.Parent:IsA("BasePart") then
  43. local fn = v:GetFullName()
  44. if not fn:find("Station") then
  45. table.insert(cache, v.Parent)
  46. end
  47. end
  48. end
  49. end
  50.  
  51. local function view(model, position)
  52. local viewportFrame = Instance.new("ViewportFrame")
  53. viewportFrame.AnchorPoint = Vector2.new(.5, .5)
  54. viewportFrame.Size = UDim2.new(0, 100, 0, 100)
  55. viewportFrame.Position = UDim2.new(0, vec.x, 0, vec.y)
  56. viewportFrame.BackgroundTransparency = 1
  57.  
  58. model:Clone().Parent = viewportFrame
  59.  
  60. local viewportCamera = Instance.new("Camera")
  61. viewportFrame.CurrentCamera = viewportCamera
  62. viewportCamera.Parent = viewportFrame
  63.  
  64. viewportCamera.CFrame = CFrame.new(position.p - cam.CFrame.lookVector*5, position.p)
  65.  
  66. viewportFrame.Parent = game.CoreGui
  67.  
  68. return viewportFrame
  69. end
  70.  
  71. local trinkets = { }
  72. local lastRefresh = tick()
  73. local function refreshTrinkets(range)
  74. for i, v in next, trinkets do
  75. v[2].Parent:Destroy()
  76. v[3]:Destroy()
  77. end
  78. trinkets = { }
  79. for i, v in next, cache do
  80. if (v.Parent.Position - game.Players.LocalPlayer.Character.Head.Position).magnitude < range then
  81. local model = v.Parent
  82. local position = model:IsA("Model") and model:GetModelCFrame() or model.CFrame
  83. table.insert(trinkets, {model, track(model), view(model, position), position})
  84. end
  85. end
  86. end
  87.  
  88. log("Done")
  89.  
  90. local range = 1000
  91. refreshTrinkets(range)
  92.  
  93. local ran = false
  94. while game.CoreGui:FindFirstChild("Logger") do
  95. if tick() - lastRefresh > 10 then
  96. lastRefresh = tick()
  97. refreshTrinkets(range)
  98. end
  99. for i, v in next, trinkets do
  100. if not v[1].Parent then
  101. table.remove(trinkets, i)
  102. else
  103. local dist = math.floor((v[1].Position-game.Players.LocalPlayer.Character.Head.Position).magnitude)
  104. v[2].Text = dist
  105.  
  106. local spawned = v.Transparency < 1
  107. for i, v in next, v:GetDescendants() do
  108. if v:IsA("BasePart") then
  109. if v.Transparency < 1 then
  110. spawned = true
  111. end
  112. end
  113. end
  114.  
  115. v[2].TextColor3 = spawned and Color3.new(0, 0, 1) or Color3.new(1, 0, 0)
  116.  
  117. local vec, on = cam:WorldToScreenPoint(v[4].p)
  118. if on then
  119. v[3].Position = UDim2.new(0, vec.x, 0, vec.y)
  120. if not v[3].Visible then
  121. v[3].Visible = true
  122. end
  123. elseif v[3].Visible then
  124. v[3].Visible = false
  125. end
  126. end
  127. end
  128. if not ran then
  129. ran = true
  130. log("working")
  131. end
  132. wait(1)
  133. end
  134.  
  135. for i, v in next, trinkets do
  136. v[2].Parent:Destroy()
  137. v[3]:Destroy()
  138. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement