Joriangames

Minimap Localscript

Oct 20th, 2020
7,910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. ---Watch my tutorial to understand everything: https://youtu.be/YRQoi88DY3I
  2. local plr = game:GetService("Players").LocalPlayer
  3. local char = plr.Character or plr.CharacterAdded
  4. local hum = char:WaitForChild("Humanoid")
  5. local humRootPart = char:WaitForChild("HumanoidRootPart")
  6. local map = game.Workspace.Map
  7. local gui = script.Parent
  8. local ViewPortFrame = gui:WaitForChild("MinimapFrame")
  9. ---get the Camera
  10. local cam = Instance.new("Camera")
  11. cam.Parent = game.Workspace
  12. cam.CameraType = Enum.CameraType.Scriptable
  13. cam.FieldOfView = 1
  14. ViewPortFrame.CurrentCamera = cam
  15.  
  16. for i, minimapObjects in pairs(map:GetChildren()) do
  17.     minimapObjects:Clone().Parent = ViewPortFrame
  18. end
  19.  
  20. game:GetService("RunService").RenderStepped:Connect(function()
  21.     local camFr = CFrame.new(humRootPart.Position+Vector3.new(0, 3500, 0), humRootPart.Position)
  22.     cam.CFrame = camFr
  23.     ViewPortFrame:WaitForChild("Arrow").Rotation = -humRootPart.Orientation.Y -90
  24. end)
Add Comment
Please, Sign In to add comment