dats-scythe

aimbot Npc for Dead rails

Feb 23rd, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.53 KB | None | 0 0
  1. local fov = 136
  2. local RunService = game:GetService("RunService")
  3. local UserInputService = game:GetService("UserInputService")
  4. local Cam = workspace.CurrentCamera
  5. local Player = game:GetService("Players").LocalPlayer
  6.  
  7. local FOVring = Drawing.new("Circle")
  8. FOVring.Visible = false
  9. FOVring.Thickness = 2
  10. FOVring.Color = Color3.fromRGB(128, 0, 128)
  11. FOVring.Filled = false
  12. FOVring.Radius = fov
  13. FOVring.Position = Cam.ViewportSize / 2
  14.  
  15. local isAiming = false
  16. local validNPCs = {}
  17. local raycastParams = RaycastParams.new()
  18. raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
  19.  
  20. local ScreenGui = Instance.new("ScreenGui")
  21. ScreenGui.Parent = game.CoreGui
  22.  
  23. local ToggleButton = Instance.new("TextButton")
  24. ToggleButton.Size = UDim2.new(0, 120, 0, 40)
  25. ToggleButton.Position = UDim2.new(0, 10, 0, 10)
  26. ToggleButton.Text = "AIMBOT: OFF"
  27. ToggleButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  28. ToggleButton.TextColor3 = Color3.fromRGB(255, 50, 50)
  29. ToggleButton.Font = Enum.Font.GothamBold
  30. ToggleButton.TextSize = 14
  31. ToggleButton.Parent = ScreenGui
  32.  
  33. local function isNPC(obj)
  34. return obj:IsA("Model")
  35. and obj:FindFirstChild("Humanoid")
  36. and obj.Humanoid.Health > 0
  37. and obj:FindFirstChild("Head")
  38. and obj:FindFirstChild("HumanoidRootPart")
  39. and not game:GetService("Players"):GetPlayerFromCharacter(obj)
  40. end
  41.  
  42. local function updateNPCs()
  43. local tempTable = {}
  44. for _, obj in ipairs(workspace:GetDescendants()) do
  45. if isNPC(obj) then
  46. tempTable[obj] = true
  47. end
  48. end
  49. for i = #validNPCs, 1, -1 do
  50. if not tempTable[validNPCs[i]] then
  51. table.remove(validNPCs, i)
  52. end
  53. end
  54. for obj in pairs(tempTable) do
  55. if not table.find(validNPCs, obj) then
  56. table.insert(validNPCs, obj)
  57. end
  58. end
  59. end
  60.  
  61. local function handleDescendant(descendant)
  62. if isNPC(descendant) then
  63. table.insert(validNPCs, descendant)
  64. local humanoid = descendant:WaitForChild("Humanoid")
  65. humanoid.Destroying:Connect(function()
  66. for i = #validNPCs, 1, -1 do
  67. if validNPCs[i] == descendant then
  68. table.remove(validNPCs, i)
  69. break
  70. end
  71. end
  72. end)
  73. end
  74. end
  75.  
  76. workspace.DescendantAdded:Connect(handleDescendant)
  77.  
  78. local function updateDrawings()
  79. FOVring.Position = Cam.ViewportSize / 2
  80. FOVring.Radius = fov * (Cam.ViewportSize.Y / 1080)
  81. end
  82.  
  83. local function predictPos(target)
  84. local rootPart = target:FindFirstChild("HumanoidRootPart")
  85. local head = target:FindFirstChild("Head")
  86. if not rootPart or not head then
  87. return head and head.Position or rootPart and rootPart.Position
  88. end
  89. local velocity = rootPart.Velocity
  90. local predictionTime = 0.02
  91. local basePosition = rootPart.Position + velocity * predictionTime
  92. local headOffset = head.Position - rootPart.Position
  93. return basePosition + headOffset
  94. end
  95.  
  96. local function getTarget()
  97. local nearest = nil
  98. local minDistance = math.huge
  99. local viewportCenter = Cam.ViewportSize / 2
  100. raycastParams.FilterDescendantsInstances = {Player.Character}
  101. for _, npc in ipairs(validNPCs) do
  102. local predictedPos = predictPos(npc)
  103. local screenPos, visible = Cam:WorldToViewportPoint(predictedPos)
  104. if visible and screenPos.Z > 0 then
  105. local ray = workspace:Raycast(
  106. Cam.CFrame.Position,
  107. (predictedPos - Cam.CFrame.Position).Unit * 1000,
  108. raycastParams
  109. )
  110. if ray and ray.Instance:IsDescendantOf(npc) then
  111. local distance = (Vector2.new(screenPos.X, screenPos.Y) - viewportCenter).Magnitude
  112. if distance < minDistance and distance < fov then
  113. minDistance = distance
  114. nearest = npc
  115. end
  116. end
  117. end
  118. end
  119. return nearest
  120. end
  121.  
  122. local function aim(targetPosition)
  123. local currentCF = Cam.CFrame
  124. local targetDirection = (targetPosition - currentCF.Position).Unit
  125. local smoothFactor = 0.581
  126. local newLookVector = currentCF.LookVector:Lerp(targetDirection, smoothFactor)
  127. Cam.CFrame = CFrame.new(currentCF.Position, currentCF.Position + newLookVector)
  128. end
  129.  
  130. local heartbeat = RunService.Heartbeat
  131. local lastUpdate = 0
  132. local UPDATE_INTERVAL = 0.4
  133.  
  134. heartbeat:Connect(function(dt)
  135. updateDrawings()
  136. lastUpdate = lastUpdate + dt
  137. if lastUpdate >= UPDATE_INTERVAL then
  138. updateNPCs()
  139. lastUpdate = 0
  140. end
  141. if isAiming then
  142. local target = getTarget()
  143. if target then
  144. local predictedPosition = predictPos(target)
  145. aim(predictedPosition)
  146. end
  147. end
  148. end)
  149.  
  150. ToggleButton.MouseButton1Click:Connect(function()
  151. isAiming = not isAiming
  152. FOVring.Visible = isAiming
  153. ToggleButton.Text = "AIMBOT: " .. (isAiming and "ON" or "OFF")
  154. ToggleButton.TextColor3 = isAiming and Color3.fromRGB(50, 255, 50) or Color3.fromRGB(255, 50, 50)
  155. end)
  156.  
  157. local dragging, dragInput, dragStart, startPos
  158.  
  159. local function update(input)
  160. local delta = input.Position - dragStart
  161. ToggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  162. end
  163.  
  164. ToggleButton.InputBegan:Connect(function(input)
  165. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  166. dragging = true
  167. dragStart = input.Position
  168. startPos = ToggleButton.Position
  169. input.Changed:Connect(function()
  170. if input.UserInputState == Enum.UserInputState.End then
  171. dragging = false
  172. end
  173. end)
  174. end
  175. end)
  176.  
  177. ToggleButton.InputChanged:Connect(function(input)
  178. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  179. dragInput = input
  180. end
  181. end)
  182.  
  183. UserInputService.InputChanged:Connect(function(input)
  184. if input == dragInput and dragging then
  185. update(input)
  186. end
  187. end)
  188.  
  189. updateNPCs()
  190. workspace.DescendantRemoved:Connect(function(descendant)
  191. if isNPC(descendant) then
  192. for i = #validNPCs, 1, -1 do
  193. if validNPCs[i] == descendant then
  194. table.remove(validNPCs, i)
  195. break
  196. end
  197. end
  198. end
  199. end)
  200.  
  201. game:GetService("Players").PlayerRemoving:Connect(function()
  202. FOVring:Remove()
  203. ScreenGui:Destroy()
  204. end)
Add Comment
Please, Sign In to add comment