Advertisement
AERQ1111

Dead Rails ESP Script v1.6

Apr 12th, 2025 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.77 KB | None | 0 0
  1. -- Dead Rails ESP Script (v1.6) 365 lines [THIS MIGHT/WILL BE OUTDATED, I DON'T HACK ANYMORE.]
  2. -- Press "[" LeftBracket, to toggle entity nametags
  3. -- Press "]" RightBracket, to toggle entity highlights
  4. -- Press "'" Quote, to toggle special item nametags (e.g. Bond & BankCombo)
  5. -- Press "P" to toggle Debug Mode
  6.  
  7. local RunService = game:GetService("RunService")
  8. local UserInputService = game:GetService("UserInputService")
  9. local Workspace = game:GetService("Workspace")
  10. local Players = game:GetService("Players")
  11. local LocalPlayer = Players.LocalPlayer
  12. local MaxDistance = 500 -- Adjust ESP range
  13.  
  14. -- Toggle's
  15. local NametagsEnabled = true
  16. local HighlightingEnabled = true
  17. local SpecialItemNametagsEnabled = true
  18.  
  19. -- Enemy base names
  20. local BaseEnemyNames = {
  21.     "RevolverOutlaw", "TurretOutlaw", "ShotgunOutlaw", "RifleOutlaw",
  22.     "Vampire", "Werewolf", "Wolf", "Walker", "Runner", "ZombieMiner",
  23.     "ZombieSheriff", "Banker", "ArmoredZombie", "SkeletonMiner",
  24.     "ZombieRevolverOfficer", "ZombieRevolverSoldier", "RunnerSoldier",
  25.     "ZombieSwordOfficer", "WalkerSoldier", "CaptainPrescott",
  26.     "Horse", "Unicorn", "NikolaTesla", "ZombieScientist"
  27. }
  28.  
  29. -- Lookup tables and model prefixes
  30. local TargetNames = {}
  31. for _, name in pairs(BaseEnemyNames) do
  32.     TargetNames[name] = true
  33.     TargetNames["Model_" .. name] = true
  34. end
  35.  
  36. -- Custom highlight colours for each enemy
  37. local HighlightColors = {
  38.     Vampire = Color3.fromRGB(235, 59, 59),
  39.     Werewolf = Color3.fromRGB(100, 100, 255),
  40.     Wolf = Color3.fromRGB(150, 150, 255),
  41.     Horse = Color3.fromRGB(150, 75, 0),
  42.     Unicorn = Color3.fromRGB(235, 80, 240),
  43.     RevolverOutlaw = Color3.fromRGB(255, 140, 0),
  44.     RifleOutlaw = Color3.fromRGB(255, 140, 0),
  45.     ShotgunOutlaw = Color3.fromRGB(255, 140, 0),
  46.     TurretOutlaw = Color3.fromRGB(255, 139, 0),
  47.     CaptainPrescott = Color3.fromRGB(59, 112, 235),
  48.     ZombieMiner = Color3.fromRGB(82, 145, 81),
  49.     ZombieRevolverOfficer = Color3.fromRGB(255, 105, 105),
  50.     ZombieRevolverSoldier = Color3.fromRGB(255, 105, 105),
  51.     ZombieSheriff = Color3.fromRGB(255, 105, 105),
  52.     ZombieSwordOfficer = Color3.fromRGB(51, 196, 45),
  53.     ArmoredZombie = Color3.fromRGB(51, 196, 45),
  54.     Walker = Color3.fromRGB(51, 196, 45),
  55.     WalkerSoldier = Color3.fromRGB(51, 196, 45),
  56.     Runner = Color3.fromRGB(51, 196, 45),
  57.     RunnerSoldier = Color3.fromRGB(51, 196, 45),
  58.     NikolaTesla = Color3.fromRGB(157, 0, 255),
  59.     Banker = Color3.fromRGB(47, 0, 255),
  60. }
  61.  
  62. -- "Model" prefix strip
  63. local function StripModelPrefix(name)
  64.     return name:match("^Model_(.+)$") or name
  65. end
  66.  
  67. -- create nametag
  68. local function CreateNametag(Model)
  69.     local Head = Model:FindFirstChild("Head")
  70.     if not Head then return end
  71.  
  72.     if Head:FindFirstChild("Nametag") then
  73.         Head.Nametag:Destroy()
  74.     end
  75.  
  76.     local BillboardGui = Instance.new("BillboardGui")
  77.     BillboardGui.Name = "Nametag"
  78.     BillboardGui.Adornee = Head
  79.     BillboardGui.Size = UDim2.new(0, 75, 0, 150)
  80.     BillboardGui.StudsOffset = Vector3.new(0, 2, 0)
  81.     BillboardGui.AlwaysOnTop = true
  82.  
  83.     local TextLabel = Instance.new("TextLabel")
  84.     TextLabel.Size = UDim2.new(1, 0, 1, 0)
  85.     TextLabel.Text = StripModelPrefix(Model.Name)
  86.     TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  87.     TextLabel.BackgroundTransparency = 1
  88.     TextLabel.TextStrokeTransparency = 0.75
  89.     TextLabel.Font = Enum.Font.Code
  90.     TextLabel.TextScaled = true
  91.     TextLabel.Parent = BillboardGui
  92.     BillboardGui.Parent = Head
  93.  
  94.     -- Distance fade effect (in & out)
  95.     local Connection
  96.     Connection = RunService.Heartbeat:Connect(function()
  97.         if not Model or not Head or not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Head") then
  98.             BillboardGui:Destroy()
  99.             Connection:Disconnect()
  100.             return
  101.         end
  102.  
  103.         local distance = (Head.Position - LocalPlayer.Character.Head.Position).Magnitude
  104.         BillboardGui.Enabled = NametagsEnabled and distance <= MaxDistance
  105.  
  106.         local alpha = math.clamp(1 - (distance / MaxDistance), 0, 1)
  107.         TextLabel.TextTransparency = 1 - alpha
  108.         TextLabel.TextStrokeTransparency = 0.75 + (1 - alpha) * 0.25
  109.     end)
  110. end
  111.  
  112. -- Highlight
  113. local function ApplyHighlight(Model)
  114.     for _, v in pairs(Model:GetChildren()) do
  115.         if v:IsA("Highlight") then v:Destroy() end
  116.     end
  117.  
  118.     local Highlighter = Instance.new("Highlight")
  119.     Highlighter.Name = "ESPHighlight"
  120.     Highlighter.FillColor = HighlightColors[StripModelPrefix(Model.Name)] or Color3.fromRGB(255, 48, 51)
  121.     Highlighter.OutlineColor = Color3.new(0, 0, 0)
  122.     Highlighter.Enabled = HighlightingEnabled
  123.     Highlighter.Parent = Model
  124. end
  125.  
  126. -- Toggle inputs
  127. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  128.     if gameProcessed then return end
  129.  
  130.     if input.KeyCode == Enum.KeyCode.LeftBracket then
  131.         NametagsEnabled = not NametagsEnabled
  132.         print("Nametags Enabled:", NametagsEnabled)
  133.         for _, model in pairs(Workspace:GetDescendants()) do
  134.             if TargetNames[model.Name] and model:IsA("Model") and model:FindFirstChild("Head") then
  135.                 local tag = model.Head:FindFirstChild("Nametag")
  136.                 if tag then tag.Enabled = NametagsEnabled end
  137.             end
  138.         end
  139.     elseif input.KeyCode == Enum.KeyCode.RightBracket then
  140.         HighlightingEnabled = not HighlightingEnabled
  141.         print("Highlighting Enabled:", HighlightingEnabled)
  142.         for _, model in pairs(Workspace:GetDescendants()) do
  143.             if TargetNames[model.Name] and model:IsA("Model") then
  144.                 for _, v in pairs(model:GetChildren()) do
  145.                     if v:IsA("Highlight") and v.Name == "ESPHighlight" then
  146.                         v.Enabled = HighlightingEnabled
  147.                     end
  148.                 end
  149.             end
  150.         end
  151.     elseif input.KeyCode == Enum.KeyCode.Quote then
  152.         SpecialItemNametagsEnabled = not SpecialItemNametagsEnabled
  153.         print("Special Item Nametags Enabled:", SpecialItemNametagsEnabled)
  154.         for _, item in pairs(Workspace:FindFirstChild("RuntimeItems"):GetChildren()) do
  155.             local tag = item:FindFirstChild("Nametag")
  156.             if tag then tag.Enabled = SpecialItemNametagsEnabled end
  157.         end
  158.     end
  159. end)
  160.  
  161. -- Esp to models
  162. local function ScanAndSetup()
  163.     for _, model in pairs(Workspace:GetDescendants()) do
  164.         if TargetNames[model.Name] and model:IsA("Model") and model:FindFirstChild("Head") then
  165.             CreateNametag(model)
  166.             ApplyHighlight(model)
  167.         end
  168.     end
  169. end
  170.  
  171. -- Initial scan
  172. ScanAndSetup()
  173.  
  174. -- Runtime watcher
  175. Workspace.DescendantAdded:Connect(function(desc)
  176.     if desc:IsA("Model") and TargetNames[desc.Name] then
  177.         task.wait(0.1)
  178.         if desc:FindFirstChild("Head") then
  179.             CreateNametag(desc)
  180.             ApplyHighlight(desc)
  181.         end
  182.     end
  183. end)
  184.  
  185. -- === SPECIAL ITEM ESP ===
  186.  
  187. local SpecialItems = {
  188.     Bond = Color3.fromRGB(255, 59, 59),
  189.     BankCombo = Color3.fromRGB(101, 66, 255),
  190. }
  191.  
  192. local function CreateSpecialItemNametag(model)
  193.     if model:FindFirstChild("Nametag") then
  194.         model.Nametag:Destroy()
  195.     end
  196.  
  197.     local adornee = model:FindFirstChild("PrimaryPart") or model:FindFirstChildWhichIsA("BasePart")
  198.     if not adornee then return end
  199.  
  200.     local BillboardGui = Instance.new("BillboardGui")
  201.     BillboardGui.Name = "Nametag"
  202.     BillboardGui.Adornee = adornee
  203.     BillboardGui.Size = UDim2.new(0, 60, 0, 35)
  204.     BillboardGui.StudsOffset = Vector3.new(0, 2.5, 0)
  205.     BillboardGui.AlwaysOnTop = true
  206.  
  207.     local TextLabel = Instance.new("TextLabel")
  208.     TextLabel.Size = UDim2.new(1, 0, 1, 0)
  209.     TextLabel.Text = model.Name
  210.     TextLabel.TextColor3 = Color3.new(1, 1, 1)
  211.     TextLabel.BackgroundTransparency = 1
  212.     TextLabel.TextStrokeTransparency = 0.75
  213.     TextLabel.Font = Enum.Font.Code
  214.     TextLabel.TextScaled = true
  215.     TextLabel.Parent = BillboardGui
  216.     BillboardGui.Parent = model
  217.  
  218.     RunService.Heartbeat:Connect(function()
  219.         if not adornee or not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Head") then return end
  220.  
  221.         local distance = (adornee.Position - LocalPlayer.Character.Head.Position).Magnitude
  222.         BillboardGui.Enabled = SpecialItemNametagsEnabled and distance <= MaxDistance
  223.  
  224.         local alpha = math.clamp(1 - (distance / MaxDistance), 0, 1)
  225.         TextLabel.TextTransparency = 1 - alpha
  226.         TextLabel.TextStrokeTransparency = 0.75 + (1 - alpha) * 0.25
  227.     end)
  228. end
  229.  
  230. local function PulseHighlight(model, color)
  231.     local highlight = Instance.new("Highlight")
  232.     highlight.Name = "ESPHighlight"
  233.     highlight.FillColor = color
  234.     highlight.OutlineColor = Color3.new(0, 0, 0)
  235.     highlight.Parent = model
  236.  
  237.     local alpha = 0
  238.     local direction = 1
  239.     RunService.Heartbeat:Connect(function(dt)
  240.         alpha += direction * dt
  241.         if alpha >= 1 then
  242.             alpha = 1
  243.             direction = -1
  244.         elseif alpha <= 0.2 then
  245.             alpha = 0.2
  246.             direction = 1
  247.         end
  248.         highlight.FillTransparency = 1 - alpha
  249.     end)
  250. end
  251.  
  252. local function HighlightSpecialItems()
  253.     local runtimeFolder = Workspace:FindFirstChild("RuntimeItems")
  254.     if not runtimeFolder then return end
  255.  
  256.     for _, item in pairs(runtimeFolder:GetChildren()) do
  257.         if item:IsA("Model") and SpecialItems[item.Name] then
  258.             for _, v in pairs(item:GetChildren()) do
  259.                 if v:IsA("Highlight") and v.Name == "ESPHighlight" then
  260.                     v:Destroy()
  261.                 end
  262.             end
  263.             PulseHighlight(item, SpecialItems[item.Name])
  264.             CreateSpecialItemNametag(item)
  265.         end
  266.     end
  267. end
  268.  
  269. HighlightSpecialItems()
  270.  
  271. Workspace:WaitForChild("RuntimeItems").ChildAdded:Connect(function(child)
  272.     if child:IsA("Model") and SpecialItems[child.Name] then
  273.         task.wait(0.1)
  274.         HighlightSpecialItems()
  275.     end
  276. end)
  277. -- === DEBUG MODE TOGGLE ===
  278. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  279. local DebugMode = false
  280. local DebugGui = Instance.new("ScreenGui", LocalPlayer:WaitForChild("PlayerGui"))
  281. DebugGui.Name = "DebugGui"
  282. DebugGui.ResetOnSpawn = false
  283.  
  284. -- Game Time UI
  285. local TimeLabel = Instance.new("TextLabel")
  286. TimeLabel.Size = UDim2.new(0, 200, 0, 40)
  287. TimeLabel.Position = UDim2.new(1, -210, 0, 10)
  288. TimeLabel.AnchorPoint = Vector2.new(0, 0)
  289. TimeLabel.BackgroundTransparency = 1
  290. TimeLabel.TextColor3 = Color3.new(1, 1, 1)
  291. TimeLabel.TextTransparency = 0.65
  292. TimeLabel.Font = Enum.Font.Code
  293. TimeLabel.TextScaled = true
  294. TimeLabel.Text = ""
  295. TimeLabel.Parent = DebugGui
  296. TimeLabel.Visible = false
  297.  
  298. -- Debug Mode UI
  299. local DebugLabel = Instance.new("TextLabel")
  300. DebugLabel.Size = UDim2.new(0, 200, 0, 40)
  301. DebugLabel.Position = UDim2.new(1, -210, 1, -50)
  302. DebugLabel.AnchorPoint = Vector2.new(0, 1)
  303. DebugLabel.BackgroundTransparency = 1
  304. DebugLabel.TextColor3 = Color3.new(1, 1, 1)
  305. DebugLabel.TextTransparency = 0.65
  306. DebugLabel.Font = Enum.Font.Code
  307. DebugLabel.TextScaled = true
  308. DebugLabel.Text = "Debug Mode"
  309. DebugLabel.Parent = DebugGui
  310. DebugLabel.Visible = false
  311.  
  312. -- Update time label
  313. RunService.Heartbeat:Connect(function()
  314.     if DebugMode and TimeLabel.Visible then
  315.         local timeVal = ReplicatedStorage:FindFirstChild("TimeHour")
  316.         local fuelVal = Workspace:FindFirstChild("Train") and Workspace.Train:FindFirstChild("Fuel")
  317.  
  318.         if timeVal and timeVal:IsA("StringValue") then
  319.             TimeLabel.Text = timeVal.Value
  320.         end
  321.  
  322.         if fuelVal and fuelVal:IsA("IntValue") then
  323.             FuelLabel.Text = "Fuel: " .. fuelVal.Value
  324.         else
  325.             FuelLabel.Text = "Fuel: N/A"
  326.         end
  327.     end
  328. end)
  329.  
  330. -- Fuel UI
  331. local FuelLabel = Instance.new("TextLabel")
  332. FuelLabel.Size = UDim2.new(0, 200, 0, 40)
  333. FuelLabel.Position = UDim2.new(1, -210, 0, 50)
  334. FuelLabel.AnchorPoint = Vector2.new(0, 0)
  335. FuelLabel.BackgroundTransparency = 1
  336. FuelLabel.TextColor3 = Color3.new(1, 1, 1)
  337. FuelLabel.TextTransparency = 0.65
  338. FuelLabel.Font = Enum.Font.Code
  339. FuelLabel.TextScaled = true
  340. FuelLabel.Text = ""
  341. FuelLabel.Parent = DebugGui
  342. FuelLabel.Visible = false
  343.  
  344. -- Toggle keybind (P)
  345. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  346.     if gameProcessed then return end
  347.  
  348.     if input.KeyCode == Enum.KeyCode.P then
  349.         DebugMode = not DebugMode
  350.         DebugLabel.Visible = DebugMode
  351.         TimeLabel.Visible = DebugMode
  352.  
  353.         if DebugMode then
  354.             print("Debug Mode ON")
  355.             UpdateDebugTags()
  356.         else
  357.             print("Debug Mode OFF")
  358.             -- Clear debug tags
  359.             for _, v in pairs(Workspace:GetDescendants()) do
  360.                 if v:IsA("BillboardGui") and v.Name == "DebugTag" then
  361.                     v:Destroy()
  362.                 end
  363.             end
  364.         end
  365.     end
  366. end)
  367. -- AERQ1111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement