Advertisement
ColdSpecs

TP To Totum Freecamming

Aug 10th, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. local UIS, RS, Camera = game:GetService("UserInputService"), game:GetService("RunService"), workspace.CurrentCamera
  2. local HighlightFolder = Instance.new("Folder", workspace)
  3. HighlightFolder.Name = "ESPHighlights"
  4.  
  5. local keybind_teleport, speed = Enum.KeyCode.T, 0.9
  6. local droneCFrame = Camera.CFrame
  7.  
  8. local function createHighlight(part)
  9. local highlight = Instance.new("Highlight")
  10. highlight.Adornee = part
  11. highlight.FillTransparency = 0.7
  12. highlight.OutlineTransparency = 0.3
  13. highlight.FillColor = Color3.fromRGB(75, 0, 130)
  14. highlight.OutlineColor = Color3.fromRGB(75, 0, 130)
  15. highlight.Parent = HighlightFolder
  16. return highlight
  17. end
  18.  
  19. local function getNearestAdornee()
  20. local cursorPosition = UIS:GetMouseLocation()
  21. local nearestAdornee = nil
  22. local smallestDistance = math.huge
  23.  
  24. for _, highlight in ipairs(HighlightFolder:GetChildren()) do
  25. if highlight:IsA("Highlight") and highlight.Adornee then
  26. local adorneePosition, onScreen = Camera:WorldToScreenPoint(highlight.Adornee.Position)
  27. if onScreen then
  28. local distance = (Vector2.new(adorneePosition.X, adorneePosition.Y) - cursorPosition).Magnitude
  29. if distance < smallestDistance then
  30. smallestDistance = distance
  31. nearestAdornee = highlight.Adornee
  32. end
  33. end
  34. end
  35. end
  36.  
  37. return nearestAdornee
  38. end
  39.  
  40. local function teleportToNearestAdornee()
  41. local nearestAdornee = getNearestAdornee()
  42. if nearestAdornee then
  43. Camera.CFrame = nearestAdornee.CFrame
  44. droneCFrame = nearestAdornee.CFrame
  45. end
  46. end
  47.  
  48. local function updateFreecam()
  49. local delta = UIS:GetMouseDelta()
  50. droneCFrame = droneCFrame * CFrame.Angles(-math.rad(delta.Y * 1), -math.rad(delta.X * 1), 0)
  51.  
  52. local mv = Vector3.new()
  53. mv = mv + (UIS:IsKeyDown(Enum.KeyCode.W) and (droneCFrame.LookVector * speed) or Vector3.new())
  54. mv = mv + (UIS:IsKeyDown(Enum.KeyCode.S) and (-droneCFrame.LookVector * speed) or Vector3.new())
  55. mv = mv + (UIS:IsKeyDown(Enum.KeyCode.A) and (-droneCFrame.RightVector * speed) or Vector3.new())
  56. mv = mv + (UIS:IsKeyDown(Enum.KeyCode.D) and (droneCFrame.RightVector * speed) or Vector3.new())
  57. mv = mv + (UIS:IsKeyDown(Enum.KeyCode.C) and (droneCFrame.UpVector * speed) or Vector3.new())
  58. mv = mv + (UIS:IsKeyDown(Enum.KeyCode.Z) and (-droneCFrame.UpVector * speed) or Vector3.new())
  59.  
  60. droneCFrame = droneCFrame + mv
  61. Camera.CFrame = droneCFrame
  62. end
  63.  
  64. UIS.InputBegan:Connect(function(input, processed)
  65. if not processed and input.KeyCode == keybind_teleport then
  66. teleportToNearestAdornee()
  67. end
  68. end)
  69.  
  70. RS.RenderStepped:Connect(updateFreecam)
  71.  
  72. -- Initialization: ESP setup
  73. local function toggleESP()
  74. highlightConnection = workspace.DescendantAdded:Connect(function(part)
  75. if part:IsA("UnionOperation") and part.Name == "State" and part.Material == Enum.Material.Neon then
  76. createHighlight(part)
  77. end
  78. end)
  79. for _, part in ipairs(workspace:GetDescendants()) do
  80. if part:IsA("UnionOperation") and part.Name == "State" and part.Material == Enum.Material.Neon then
  81. createHighlight(part)
  82. end
  83. end
  84. end
  85.  
  86. toggleESP() -- Enable ESP by default
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement