Dead Rails Script | Aimbot

-- made by yee_kunkun(my roblox user name haha) local fov = 136 local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Cam = workspace.CurrentCamera local Player = game:GetService("Players").LocalPlayer local FOVring = Drawing.new("Circle") FOVring.Visible = false FOVring.Thickness = 2 FOVring.Color = Color3.fromRGB(128, 0, 128) FOVring.Filled = false FOVring.Radius = fov FOVring.Position = Cam.ViewportSize / 2 local isAiming = false local validNPCs = {} local raycastParams = RaycastParams.new() raycastParams.FilterType = Enum.RaycastFilterType.Blacklist local ScreenGui = Instance.new("ScreenGui") ScreenGui.Parent = game.CoreGui local ToggleButton = Instance.new("TextButton") ToggleButton.Size = UDim2.new(0, 120, 0, 40) ToggleButton.Position = UDim2.new(0, 10, 0, 10) ToggleButton.Text = "AIMBOT: OFF" ToggleButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30) ToggleButton.TextColor3 = Color3.fromRGB(255, 50, 50) ToggleButton.Font = Enum.Font.GothamBold ToggleButton.TextSize = 14 ToggleButton.Parent = ScreenGui local function isNPC(obj) return obj:IsA("Model") and obj:FindFirstChild("Humanoid") and obj.Humanoid.Health > 0 and obj:FindFirstChild("Head") and obj:FindFirstChild("HumanoidRootPart") and not game:GetService("Players"):GetPlayerFromCharacter(obj) end local function updateNPCs() local tempTable = {} for _, obj in ipairs(workspace:GetDescendants()) do if isNPC(obj) then tempTable[obj] = true end end for i = #validNPCs, 1, -1 do if not tempTable[validNPCs[i]] then table.remove(validNPCs, i) end end for obj in pairs(tempTable) do if not table.find(validNPCs, obj) then table.insert(validNPCs, obj) end end end local function handleDescendant(descendant) if isNPC(descendant) then table.insert(validNPCs, descendant) local humanoid = descendant:WaitForChild("Humanoid") humanoid.Destroying:Connect(function() for i = #validNPCs, 1, -1 do if validNPCs[i] == descendant then table.remove(validNPCs, i) break end end end) end end workspace.DescendantAdded:Connect(handleDescendant) local function updateDrawings() FOVring.Position = Cam.ViewportSize / 2 FOVring.Radius = fov * (Cam.ViewportSize.Y / 1080) end local function predictPos(target) local rootPart = target:FindFirstChild("HumanoidRootPart") local head = target:FindFirstChild("Head") if not rootPart or not head then return head and head.Position or rootPart and rootPart.Position end local velocity = rootPart.Velocity local predictionTime = 0.02 local basePosition = rootPart.Position + velocity * predictionTime local headOffset = head.Position - rootPart.Position return basePosition + headOffset end local function getTarget() local nearest = nil local minDistance = math.huge local viewportCenter = Cam.ViewportSize / 2 raycastParams.FilterDescendantsInstances = {Player.Character} for _, npc in ipairs(validNPCs) do local predictedPos = predictPos(npc) local screenPos, visible = Cam:WorldToViewportPoint(predictedPos) if visible and screenPos.Z > 0 then local ray = workspace:Raycast( Cam.CFrame.Position, (predictedPos - Cam.CFrame.Position).Unit * 1000, raycastParams ) if ray and ray.Instance:IsDescendantOf(npc) then local distance = (Vector2.new(screenPos.X, screenPos.Y) - viewportCenter).Magnitude if distance < minDistance and distance < fov then minDistance = distance nearest = npc end end end end return nearest end local function aim(targetPosition) local currentCF = Cam.CFrame local targetDirection = (targetPosition - currentCF.Position).Unit local smoothFactor = 0.581 local newLookVector = currentCF.LookVector:Lerp(targetDirection, smoothFactor) Cam.CFrame = CFrame.new(currentCF.Position, currentCF.Position + newLookVector) end local heartbeat = RunService.Heartbeat local lastUpdate = 0 local UPDATE_INTERVAL = 0.4 heartbeat:Connect(function(dt) updateDrawings() lastUpdate = lastUpdate + dt if lastUpdate >= UPDATE_INTERVAL then updateNPCs() lastUpdate = 0 end if isAiming then local target = getTarget() if target then local predictedPosition = predictPos(target) aim(predictedPosition) end end end) ToggleButton.MouseButton1Click:Connect(function() isAiming = not isAiming FOVring.Visible = isAiming ToggleButton.Text = "AIMBOT: " .. (isAiming and "ON" or "OFF") ToggleButton.TextColor3 = isAiming and Color3.fromRGB(50, 255, 50) or Color3.fromRGB(255, 50, 50) end) local dragging, dragInput, dragStart, startPos local function update(input) local delta = input.Position - dragStart ToggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end ToggleButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = ToggleButton.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) ToggleButton.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then update(input) end end) updateNPCs() workspace.DescendantRemoved:Connect(function(descendant) if isNPC(descendant) then for i = #validNPCs, 1, -1 do if validNPCs[i] == descendant then table.remove(validNPCs, i) break end end end end) game:GetService("Players").PlayerRemoving:Connect(function() FOVring:Remove() ScreenGui:Destroy() end)
views: 67
2025-02-22 13:31:03