Advertisement
anphu04

Top Down Radar GUI Roblox

Apr 7th, 2020
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.28 KB | None | 0 0
  1. -- 7/4/2020 by Konethorix
  2. local plr = game:GetService("Players").LocalPlayer
  3. repeat wait() until workspace.CurrentCamera
  4. local cam = workspace.CurrentCamera
  5. local run = game:GetService("RunService")
  6.  
  7. -- Instances:
  8.  
  9. local RadarGui = Instance.new("ScreenGui")
  10. local Frame = Instance.new("Frame")
  11. local Viewport = Instance.new("ViewportFrame")
  12. local Title = Instance.new("TextLabel")
  13. local Exit = Instance.new("TextButton")
  14. local Mini = Instance.new("TextButton")
  15. local Arrow = Instance.new("ImageLabel")
  16. local Dot = Instance.new("ImageLabel")
  17. local Dist = Instance.new("TextButton")
  18. local Range_ = Instance.new("TextLabel")
  19. local Range = Instance.new("TextLabel")
  20. local Refresh = Instance.new("TextButton")
  21.  
  22. local exited = false
  23. local minied = false
  24. local height = 4000
  25.  
  26. --Properties:
  27.  
  28. RadarGui.Name = "RadarGui"
  29. RadarGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  30. RadarGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  31. RadarGui.ResetOnSpawn = false
  32.  
  33. Frame.Parent = RadarGui
  34. Frame.Active = true
  35. Frame.BackgroundColor3 = Color3.fromRGB(85, 170, 255)
  36. Frame.Draggable = true
  37. Frame.Position = UDim2.new(0, 50, 1, -400)
  38. Frame.Size = UDim2.new(0, 320, 0, 30)
  39.  
  40. Viewport.BackgroundColor3 = Color3.fromRGB(74, 74, 74)
  41. Viewport.Name = "Viewport"
  42. Viewport.Parent = Frame
  43. Viewport.BackgroundColor3 = Color3.fromRGB(74, 74, 74)
  44. Viewport.Size = UDim2.new(0, 320, 0, 320)
  45. Viewport.Position = UDim2.new(0, 0, 1, 0)
  46. Viewport.LightDirection = Vector3.new(0,1,0)
  47. Viewport.Ambient = Color3.new(1,1,1)
  48. Viewport.LightColor = Color3.new(1,1,1)
  49.  
  50. Title.Name = "Title"
  51. Title.Parent = Frame
  52. Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  53. Title.BackgroundTransparency = 1.000
  54. Title.Size = UDim2.new(0, 260, 1, 0)
  55. Title.Font = Enum.Font.SourceSans
  56. Title.Text = "Top down radar by Konethorix"
  57. Title.TextColor3 = Color3.fromRGB(0, 0, 0)
  58. Title.TextScaled = true
  59. Title.TextSize = 14.000
  60. Title.TextWrapped = true
  61.  
  62. Exit.Name = "Exit"
  63. Exit.Parent = Frame
  64. Exit.BackgroundColor3 = Color3.fromRGB(255, 76, 76)
  65. Exit.Position = UDim2.new(0, 290, 0, 0)
  66. Exit.Size = UDim2.new(0, 30, 1, 0)
  67. Exit.Font = Enum.Font.SourceSans
  68. Exit.Text = "X"
  69. Exit.TextColor3 = Color3.fromRGB(0, 0, 0)
  70. Exit.TextScaled = true
  71. Exit.TextSize = 14.000
  72. Exit.TextWrapped = true
  73.  
  74. Mini.Name = "Mini"
  75. Mini.Parent = Frame
  76. Mini.BackgroundColor3 = Color3.fromRGB(255, 201, 62)
  77. Mini.Position = UDim2.new(0, 260, 0, 0)
  78. Mini.Size = UDim2.new(0, 30, 1, 0)
  79. Mini.Font = Enum.Font.SourceSans
  80. Mini.Text = "_"
  81. Mini.TextColor3 = Color3.fromRGB(0, 0, 0)
  82. Mini.TextScaled = true
  83. Mini.TextSize = 14.000
  84. Mini.TextWrapped = true
  85.  
  86. Arrow.Name = "Arrow"
  87. Arrow.Parent = Viewport
  88. Arrow.AnchorPoint = Vector2.new(0.5, 0.5)
  89. Arrow.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  90. Arrow.BackgroundTransparency = 1.000
  91. Arrow.Position = UDim2.new(0.5, 0, 0.5, 0)
  92. Arrow.Size = UDim2.new(0, 30, 0, 20)
  93. Arrow.Image = "rbxassetid://402675744"
  94. Arrow.ImageColor3 = Color3.fromRGB(255, 53, 53)
  95. Arrow.Visible = false
  96.  
  97. Dot.Name = "Dot"
  98. Dot.Parent = Viewport
  99. Dot.AnchorPoint = Vector2.new(0.5, 0.5)
  100. Dot.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  101. Dot.BorderSizePixel = 2
  102. Dot.Position = UDim2.new(0.5, 0, 0.5, 0)
  103. Dot.Size = UDim2.new(0, 6, 0, 6)
  104.  
  105. Dist.Name = "Dist"
  106. Dist.Parent = Viewport
  107. Dist.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  108. Dist.Position = UDim2.new(1, 0, 0, 0)
  109. Dist.Size = UDim2.new(0, 50, 0, 50)
  110. Dist.Font = Enum.Font.SourceSans
  111. Dist.Text = ""
  112. Dist.TextColor3 = Color3.fromRGB(0, 0, 0)
  113. Dist.TextSize = 14.000
  114.  
  115. Range_.Name = "Range_"
  116. Range_.Parent = Dist
  117. Range_.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  118. Range_.BackgroundTransparency = 1.000
  119. Range_.Size = UDim2.new(1, 0, 0, 20)
  120. Range_.Font = Enum.Font.SourceSans
  121. Range_.Text = "Height"
  122. Range_.TextColor3 = Color3.fromRGB(0, 0, 0)
  123. Range_.TextScaled = true
  124. Range_.TextSize = 14.000
  125. Range_.TextWrapped = true
  126.  
  127. Range.Name = "Range"
  128. Range.Parent = Dist
  129. Range.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  130. Range.BackgroundTransparency = 1.000
  131. Range.Position = UDim2.new(0, 0, 0, 20)
  132. Range.Size = UDim2.new(1, 0, 0, 30)
  133. Range.Font = Enum.Font.ArialBold
  134. Range.Text = "4000"
  135. Range.TextColor3 = Color3.fromRGB(0, 0, 0)
  136. Range.TextScaled = true
  137. Range.TextSize = 14.000
  138. Range.TextWrapped = true
  139.  
  140. Refresh.Name = "Refresh"
  141. Refresh.Parent = Viewport
  142. Refresh.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  143. Refresh.Position = UDim2.new(1, 0, 0, 55)
  144. Refresh.Size = UDim2.new(0, 64, 0, 50)
  145. Refresh.Font = Enum.Font.SourceSansBold
  146. Refresh.Text = "Refresh Map"
  147. Refresh.TextColor3 = Color3.fromRGB(0, 0, 0)
  148. Refresh.TextScaled = true
  149. Refresh.TextSize = 14.000
  150. Refresh.TextWrapped = true
  151.  
  152. -- Camera section
  153.  
  154. local fakecam = Instance.new("Camera")
  155. fakecam.Name = "FakeCamera"
  156. fakecam.CameraType = "Scriptable"
  157. fakecam.FieldOfView = 10
  158. fakecam.Parent = plr.PlayerGui
  159. Viewport.CurrentCamera = fakecam
  160.  
  161.  
  162. local mapModel = Instance.new("Model")
  163. mapModel.Parent = Viewport
  164.  
  165. function refresh()
  166.     mapModel:ClearAllChildren()
  167.     for i,child in pairs(workspace:GetDescendants()) do
  168.         if child ~= workspace.Terrain and not (game:GetService("Players"):GetPlayerFromCharacter(child)) then
  169.             if child:IsA("BasePart") then
  170.                 child:Clone().Parent = mapModel
  171.             elseif child:IsA("MeshPart") then
  172.                 local rechild = Instance.new("Part")
  173.                 rechild.TopSurface = 0
  174.                 rechild.BottomSurface = 0
  175.                 rechild.Color = child.Color
  176.                 rechild.Transparency = child.Transparency
  177.                 rechild.Reflectance = child.Reflectance
  178.                 rechild.Material = child.Material
  179.                 rechild.Size = child.Size
  180.                 rechild.CFrame = child.CFrame
  181.                 rechild.Parent = mapModel
  182.             end
  183.         end
  184.     end
  185. end
  186. refresh()
  187.  
  188.  
  189. spawn(function()
  190.     while not exited do
  191.         run.Heartbeat:Wait()
  192.        
  193.         local char = plr.Character
  194.         if char then
  195.             local root = char:FindFirstChild("HumanoidRootPart")
  196.             if root then
  197.                 local rotX,rotY,rotZ = cam.CFrame:ToEulerAnglesYXZ()
  198.                 fakecam.CFrame = CFrame.new(root.Position + Vector3.new(0,height,0), root.Position) * CFrame.Angles(0,0,rotY + math.pi/2)
  199.             end
  200.         end
  201.     end
  202. end)
  203. -- interesting examination
  204. --[[
  205.     local Direction = (Vector2.new(Cam.Focus.x,Cam.Focus.z)-Vector2.new(Cam.CoordinateFrame.x,Cam.CoordinateFrame.z)).unit --Calculates where you're looking
  206.     N.Position = UDim2.new(0.5,-Direction.x * Radius.Value,0.5,Direction.y * Radius.Value) --Moves the north symbol
  207.     E.Position = UDim2.new(0.5,-Direction.y * Radius.Value,0.5,-Direction.x * Radius.Value) --Moves the east symbol
  208.     S.Position = UDim2.new(0.5,Direction.x * Radius.Value,0.5,-Direction.y * Radius.Value) --Moves the south symbol
  209.     W.Position = UDim2.new(0.5,Direction.y * Radius.Value,0.5,Direction.x * Radius.Value) --Moves the west symbol
  210. ]]
  211.  
  212.  
  213.  
  214. Mini.MouseButton1Down:Connect(function()
  215.     if not minied then
  216.         minied = true
  217.         Viewport.Visible = false
  218.     else
  219.         minied = false
  220.         Viewport.Visible = true
  221.     end
  222. end)
  223.  
  224. Exit.MouseButton1Click:Connect(function()
  225.     exited = true
  226.     RadarGui:Destroy()
  227.     fakecam:Destroy()
  228.     wait(.5)
  229.     script:Destroy()
  230. end)
  231.  
  232.  
  233. Dist.MouseButton1Down:Connect(function()
  234.     local allHeights = {
  235.         [4000] = 6000,
  236.         [6000] = 8000,
  237.         [8000] = 10000,
  238.         [10000] = 15000,
  239.         [15000] = 20000,
  240.         [20000] = 40000,
  241.         [40000] = 60000,
  242.         [60000] = 4000,
  243.     }
  244.     local newHeight = allHeights[height]
  245.     height = newHeight
  246.     Range.Text = tostring(newHeight)
  247. end)
  248.  
  249. Refresh.MouseButton1Click:Connect(refresh)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement