-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] --[[rscripts:analytics:start]] -- Script analytics (enabled by the creator on rscripts.net). -- Runs in its own thread and cannot affect the script below. task.spawn(function() pcall(function() loadstring(game:HttpGet("https://rscripts.net/api/telemetry/v2/client.lua?s=6ad413a13d81c9c297cb53c1"))() end) end) --[[rscripts:analytics:end]] --[[ MAKE SURE TO PUT THIS IN YOUT AUTOEXECUTE FOLER SO THAT IT CAN AUTOFARM LOOP! YS Dead Rails If you enjoy the script, please consider liking the post. It helps motivate me to release more open-source scripts and keep existing ones updated. MADE BY: https://rscripts.net/@Yamis_Scripts ]] local source = [=====[ local source, startup, fromTeleport, queueTeleport, player = ... local ReplicatedStorage = game:GetService("ReplicatedStorage") local PREFIX = "[YS Dead Rails]" local RELEASE_GAME = 70876832253163 local RELEASE_LOBBY = 116495829188952 local POLL_INTERVAL = 0.05 local REQUEST_INTERVAL = 1 / 9 local MIN_REQUEST_GAP = 0.1 local READY_INTERVAL = 8 local MISSING_INTERVAL = 2 type Bond = { entity: number, serverEntity: number, stage: string, stageSince: number, order: number, attempts: number, usedSack: boolean, sackEntity: number?, missingSince: number?, model: Instance?, } type Run = { queued: boolean?, firstBalance: number?, lastBalance: number?, lastProgress: number?, readySince: number?, unmapped: { [number]: boolean }?, emptySince: number?, lastCollect: number?, lastStore: number?, characterEntity: number?, remaining: number?, lobbySentAt: number?, partyStage: string?, partySince: number?, partyAttempts: number?, } local previousBonds: { [number]: Bond }? local previousCollectAt: number? local previousStoreAt: number? local previousRun: Run? = {} local previous = player:FindFirstChild("YS Dead Rails") if previous then assert( previous:IsA("BindableFunction") and previous:GetAttribute("Purpose") == "Collect bonds", PREFIX .. " Collector name is already in use." ) if fromTeleport and previous:GetAttribute("Running") == true then return end previousBonds, previousCollectAt, previousStoreAt, previousRun = previous:Invoke() print(PREFIX .. " Previous instance cleared and reran.") end previousRun = previousRun or {} local collector = Instance.new("BindableFunction") collector.Name = "YS Dead Rails" collector:SetAttribute("Purpose", "Collect bonds") collector:SetAttribute("Running", true) local running = true local queued = previousRun.queued == true local teleportFailed = false local worker: thread? local teleportConnection: RBXScriptConnection? local bondConnection local notice local function stop(keepMarker: boolean?) if not running then if not keepMarker then collector:Destroy() end return end running = false if teleportConnection then teleportConnection:Disconnect() end if bondConnection then bondConnection:Disconnect() end if worker and worker ~= coroutine.running() and coroutine.status(worker) ~= "dead" then task.cancel(worker) end if notice then notice.destroy() end if keepMarker then collector:SetAttribute("Running", false) else collector:Destroy() end end collector.OnInvoke = function() previousRun.queued = queued if teleportFailed then previousRun.lobbySentAt = nil previousRun.emptySince = nil previousRun.partyStage = "ready" previousRun.partySince = os.clock() previousRun.partyAttempts = 0 end stop() return previousBonds, previousCollectAt, previousStoreAt, previousRun end collector.Parent = player teleportConnection = player.OnTeleport:Connect(function(teleportState, placeId) if teleportState == Enum.TeleportState.Started then if queued or (placeId ~= RELEASE_GAME and placeId ~= RELEASE_LOBBY) then return end queued = true local code = ( "local source = %q\nlocal startup = %q\nlocal fromTeleport = true\n%s" ):format(source, startup, startup) local sent, problem = pcall(queueTeleport, code) if not sent then queued = false warn(PREFIX .. " Teleport continuation failed: " .. tostring(problem)) stop() end elseif teleportState == Enum.TeleportState.Failed then teleportFailed = true warn(PREFIX .. " Teleport failed. Execute again to retry.") stop(queued) elseif teleportState == Enum.TeleportState.InProgress then stop() end end) print(PREFIX .. " Made by Yamis_Scripts.") print(PREFIX .. " Running.") local function createNotice(playerGui: PlayerGui) local RunService = game:GetService("RunService") local GuiService = game:GetService("GuiService") local colours = { background = Color3.fromRGB(24, 27, 29), border = Color3.fromRGB(53, 59, 62), primary = Color3.fromRGB(237, 240, 238), secondary = Color3.fromRGB(175, 185, 180), track = Color3.fromRGB(48, 56, 52), progress = Color3.fromRGB(148, 186, 157), } local gui = Instance.new("ScreenGui") gui.Name = "Bond return" gui.ResetOnSpawn = false gui.ScreenInsets = Enum.ScreenInsets.CoreUISafeInsets gui.ClipToDeviceSafeArea = true gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.DisplayOrder = 50 gui.Enabled = false gui.Parent = playerGui local bounds = Instance.new("Frame") bounds.Name = "Bounds" bounds.BackgroundTransparency = 1 bounds.Size = UDim2.fromScale(1, 1) bounds.Active = false bounds.Parent = gui local panel = Instance.new("CanvasGroup") panel.Name = "Bonds" panel.AnchorPoint = Vector2.new(1, 1) panel.Position = UDim2.new(1, -16, 1, -16) panel.Size = UDim2.new(1, -32, 0, 113) panel.BackgroundColor3 = colours.background panel.BorderSizePixel = 0 panel.GroupTransparency = 1 panel.Active = false panel.Interactable = false panel.Parent = bounds local limit = Instance.new("UISizeConstraint") limit.MinSize = Vector2.new(0, 0) limit.MaxSize = Vector2.new(328, 150) limit.Parent = panel local scale = Instance.new("UIScale") scale.Parent = panel local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 5) corner.Parent = panel local border = Instance.new("UIStroke") border.Color = colours.border border.Thickness = 1 border.BorderStrokePosition = Enum.BorderStrokePosition.Inner border.ApplyStrokeMode = Enum.ApplyStrokeMode.Border border.Parent = panel local function label(name: string, text: string, font: Enum.Font, colour: Color3) local value = Instance.new("TextLabel") value.Name = name value.BackgroundTransparency = 1 value.BorderSizePixel = 0 value.Text = text value.TextColor3 = colour value.Font = font value.TextScaled = false value.TextWrapped = false value.TextXAlignment = Enum.TextXAlignment.Left value.TextYAlignment = Enum.TextYAlignment.Center value.Active = false value.Parent = panel return value end local heading = label("Heading", "Bonds earned", Enum.Font.GothamMedium, colours.secondary) local amount = label("Amount", "+0", Enum.Font.Code, colours.primary) local status = label("Status", "Lobby return", Enum.Font.GothamMedium, colours.secondary) local countdown = label("Countdown", "5.0 s", Enum.Font.Code, colours.primary) countdown.AnchorPoint = Vector2.new(1, 0) countdown.TextXAlignment = Enum.TextXAlignment.Right local track = Instance.new("Frame") track.Name = "Countdown progress" track.AnchorPoint = Vector2.new(0, 1) track.Position = UDim2.new(0, 14, 1, -12) track.Size = UDim2.new(1, -28, 0, 3) track.BorderSizePixel = 0 track.BackgroundColor3 = colours.track track.Parent = panel local fill = Instance.new("Frame") fill.Name = "Elapsed" fill.BorderSizePixel = 0 fill.BackgroundColor3 = colours.progress fill.Size = UDim2.fromScale(0, 1) fill.Parent = track local textSizes = { [Enum.PreferredTextSize.Medium] = 1, [Enum.PreferredTextSize.Large] = 1.15, [Enum.PreferredTextSize.Larger] = 1.3, [Enum.PreferredTextSize.Largest] = 1.5, } local visible = false local destroyed = false local openedAt = 0 local deadline: number? local lastEarned: number? local lastTenths: number? local renderConnection: RBXScriptConnection? local layout = { width = 0, height = 0, textSize = 0, scale = 0, nextTouchCheck = 0 } local touchGui: ScreenGui? local jumpButton: GuiObject? local function render() local size = bounds.AbsoluteSize if size.X <= 0 or size.Y <= 0 then return end local now = os.clock() local textSize = textSizes[GuiService.PreferredTextSize] or 1 local uiScale = math.clamp(math.min(size.X / 1280, size.Y / 720), 1, 1.6) if GuiService:IsTenFootInterface() then uiScale = math.max(uiScale, 1.3) end if now >= layout.nextTouchCheck then touchGui = playerGui:FindFirstChild("TouchGui") :: ScreenGui? local controls = touchGui and touchGui:FindFirstChild("TouchControlFrame") jumpButton = controls and controls:FindFirstChild("JumpButton") :: GuiObject? layout.nextTouchCheck = now + 0.25 end local bottom = 16 if touchGui and touchGui.Enabled and jumpButton and jumpButton.Parent and jumpButton.Visible then local safeBottom = bounds.AbsolutePosition.Y + size.Y bottom = math.max(bottom, safeBottom - jumpButton.AbsolutePosition.Y + 12) end local height = 39 + math.ceil(74 * textSize) bottom = math.min(bottom, math.max(16, size.Y - height * uiScale - 12)) if layout.width ~= size.X or layout.height ~= size.Y or layout.textSize ~= textSize or layout.scale ~= uiScale then layout.width, layout.height, layout.textSize = size.X, size.Y, textSize layout.scale = uiScale scale.Scale = uiScale panel.Size = UDim2.new(1 / uiScale, -32 / uiScale, 0, height) heading.TextSize = 13 * textSize heading.Position = UDim2.fromOffset(14, 10) heading.Size = UDim2.new(1, -28, 0, 20 * textSize) amount.TextSize = 26 * textSize amount.Position = UDim2.fromOffset(14, 10 + 20 * textSize) amount.Size = UDim2.new(1, -28, 0, 34 * textSize) status.TextSize = 13 * textSize status.Position = UDim2.fromOffset(14, 16 + 54 * textSize) countdown.TextSize = 14 * textSize countdown.Position = UDim2.new(1, -14, 0, 16 + 54 * textSize) countdown.Size = UDim2.fromOffset(64 * textSize, 20 * textSize) end local entrance = math.clamp((now - openedAt) / 0.18, 0, 1) local opacity = 1 - (1 - entrance) ^ 3 local slide = 10 * (1 - opacity) if GuiService.ReducedMotionEnabled then opacity, slide = 1, 0 end panel.GroupTransparency = 1 - opacity panel.Position = UDim2.new(1, -16, 1, -bottom + slide) if deadline then status.Size = UDim2.new(1, -36 - 64 * textSize, 0, 20 * textSize) local seconds = math.max(0, deadline - now) local tenths = math.ceil(seconds * 10) if tenths ~= lastTenths then lastTenths = tenths countdown.Text = ("%.1f s"):format(tenths / 10) end fill.Size = UDim2.fromScale(math.clamp(1 - seconds / 5, 0, 1), 1) else status.Size = UDim2.new(1, -28, 0, 20 * textSize) countdown.Text = "" fill.Size = UDim2.fromScale(1, 1) end end local function display(earned: number, returnAt: number?) if destroyed then return end if deadline ~= returnAt then lastTenths = nil end deadline = returnAt status.Text = if deadline then "Lobby return" else "Returning to lobby" if earned ~= lastEarned then lastEarned = earned amount.Text = ("%+d"):format(earned) end if not visible then visible = true openedAt = os.clock() lastTenths = nil gui.Enabled = true renderConnection = RunService.RenderStepped:Connect(render) end render() end local function hide() visible = false deadline = nil lastTenths = nil if renderConnection then renderConnection:Disconnect() renderConnection = nil end if not destroyed then gui.Enabled = false panel.GroupTransparency = 1 fill.Size = UDim2.fromScale(0, 1) end end return { show = function(earned: number, returnAt: number) display(earned, returnAt) end, hide = hide, departing = function(earned: number) display(earned, nil) end, destroy = function() if destroyed then return end hide() destroyed = true gui:Destroy() end, } end local function runLobby(Shared, Client, PlayerDataController): string? local partyStage = previousRun.partyStage or "ready" local partySince = previousRun.partySince or os.clock() local partyAttempts = previousRun.partyAttempts or 0 local waitingSince: number? = os.clock() collector.OnInvoke = function() stop() return nil, nil, nil, { queued = queued, partyStage = if teleportFailed then "ready" else partyStage, partySince = if teleportFailed then os.clock() else partySince, partyAttempts = if teleportFailed then 0 else partyAttempts, } end local Remotes = require(Shared.Universe.Remotes) local PartyCreationState = require(Client.Lobby.Party.PartyCreationState) local goToPartyZone = require(Client.Lobby.Party.goToPartyZone) local Packages = ReplicatedStorage:WaitForChild("Packages", 30) assert(Packages, "Dead Rails packages did not load.") local untrack: (() -> any) -> any = require(Packages.vide).untrack while running do local now = os.clock() local character = player.Character local root = character and character:FindFirstChild("HumanoidRootPart") local humanoid = character and character:FindFirstChildOfClass("Humanoid") local playerGui = player:FindFirstChildOfClass("PlayerGui") local ready = game:IsLoaded() and PlayerDataController.hasLoaded() and character and character.Parent and root and root:IsA("BasePart") and humanoid and humanoid.Health > 0 and playerGui and playerGui:FindFirstChild("ExitParty") if not ready then waitingSince = waitingSince or now if now - waitingSince >= 30 then return "Lobby data or character did not finish loading." end else waitingSince = nil local inParty = untrack(PartyCreationState.exitPartyVisible) local isOpen = untrack(PartyCreationState.isOpen) if partyStage == "ready" then if inParty then partyStage = "leaving" partySince = now Remotes.ExitParty:FireServer() print(PREFIX .. " Leaving the current party to create a solo party.") else partyStage = "pad" partySince = now - 5 end end if partyStage == "leaving" then if not inParty then partyStage = "pad" partySince = now - 5 elseif now - partySince >= 10 then return "The current party did not close." end end if partyStage == "pad" then if inParty then return "Party membership changed before solo creation." elseif isOpen then if untrack(PartyCreationState.timeoutTime) > workspace:GetServerTimeNow() then local settings = table.clone(untrack(PartyCreationState.partySettings)) settings.maxMembers = 1 settings.isPrivate = true partyStage = "creating" partySince = now Remotes.CreateParty:FireServer(settings) print(PREFIX .. " Solo party requested.") elseif now - partySince >= 5 then return "The party pad reservation expired." end elseif now - partySince >= 5 then if partyAttempts >= 3 then return "No party pad reservation was received after three attempts." end partyAttempts += 1 partySince = now goToPartyZone() end elseif partyStage == "creating" then if inParty then partyStage = "launch" partySince = now print(PREFIX .. " Solo party joined. Waiting for the match.") elseif now - partySince >= 15 then return "The solo party request was not confirmed." end elseif partyStage == "launch" and now - partySince >= 45 then return "The solo party did not start a match." end end task.wait(POLL_INTERVAL) end return nil end local function run(): string? if not running then return nil end local Shared = ReplicatedStorage:WaitForChild("Shared", 30) local Client = ReplicatedStorage:WaitForChild("Client", 30) assert(Shared and Client, "Dead Rails client modules did not load.") local PlayerDataController = require(Client.Universe.PlayerDataController) if game.PlaceId == RELEASE_LOBBY then return runLobby(Shared, Client, PlayerDataController) end local World = require(Shared.Universe.ECS.world) local Components = require(Shared.Universe.ECS.components) local ClientReplicator = require(Client.Universe.Replication.clientReplicator) local Remotes = require(Shared.Universe.Remotes) local CollectionService = game:GetService("CollectionService") local collectBucket = Remotes.Actionable._bucket local storeBucket = Remotes.Store._bucket local findFirstChildWith = require(Shared.Universe.findFirstChildWith) local hasInteractionPermission = require(Shared.Universe.Interactable.hasInteractionPermission) local capabilityLocks = require(Client.Game.ClientState.capabilityLocks) local Capability = require(Shared.Game.Capability) local lobbyRemotes = ReplicatedStorage:WaitForChild("Remotes", 30) local returnToLobby = lobbyRemotes and lobbyRemotes:WaitForChild("ReturnToLooby", 30) assert(returnToLobby and returnToLobby:IsA("RemoteEvent"), "ReturnToLooby remote is missing.") if not running then return nil end local playerGui = player:WaitForChild("PlayerGui", 30) assert(playerGui, "PlayerGui did not load.") if not running then return nil end notice = createNotice(playerGui) local bonds: { [number]: Bond } = previousBonds or {} local order = 0 for _, bond in bonds do order = math.max(order, bond.order) end local characterEntity: number? = previousRun.characterEntity local nextScan = 0 local nextCollect = previousCollectAt or 0 local nextStore = previousStoreAt or 0 local lastCollect: number? = previousRun.lastCollect local lastStore: number? = previousRun.lastStore local contents: { [number]: boolean } = {} local remaining = previousRun.remaining or 0 local lastProgress = previousRun.lastProgress or os.clock() local emptySince: number? = previousRun.emptySince local firstBalance: number? = previousRun.firstBalance local lastBalance: number? = previousRun.lastBalance local readySince: number? = previousRun.readySince local unmapped: { [number]: boolean } = previousRun.unmapped or {} local seen: { [number]: boolean } = {} local lobbySentAt: number? = previousRun.lobbySentAt local lastReadyAt = os.clock() local reportedProgress: number? collector.OnInvoke = function() stop() return bonds, nextCollect, nextStore, { queued = queued, firstBalance = firstBalance, lastBalance = lastBalance, lastProgress = lastProgress, readySince = if teleportFailed then nil else readySince, unmapped = unmapped, emptySince = if teleportFailed then nil else emptySince, lastCollect = lastCollect, lastStore = lastStore, characterEntity = characterEntity, remaining = remaining, lobbySentAt = if teleportFailed then nil else lobbySentAt, } end bondConnection = Remotes.DisplayBonds.OnClientEvent:Connect(function() lastProgress = os.clock() emptySince = nil nextScan = 0 end) local function setStage(bond: Bond, stage: string, now: number) bond.stage = stage bond.stageSince = now bond.missingSince = nil lastProgress = now emptySince = nil end local function rememberBond(entity: number, now: number) local serverEntity = ClientReplicator:get_server_entity(entity) if not serverEntity then if not unmapped[entity] then unmapped[entity] = true lastProgress = now end return end unmapped[entity] = nil local bond = bonds[serverEntity] if bond then bond.entity = entity else order += 1 bonds[serverEntity] = { entity = entity, serverEntity = serverEntity, stage = "collect", stageSince = now, order = order, attempts = 0, usedSack = false, } lastProgress = now end end local function scan(now: number) table.clear(seen) for entity, objectId in World:query(Components.ObjectId) do if objectId == "bond" then seen[entity] = true end end for entity, modelPath in World:query(Components.ModelPath) do if modelPath == "ReplicatedStorage/Assets/ObjectModels/Valuable/bond" then seen[entity] = true end end for entity, actionable in World:query(Components.Actionable) do if actionable and actionable.callback == "collect_bond" then seen[entity] = true end end local count = 0 for entity in seen do count += 1 rememberBond(entity, now) end for entity in unmapped do if ClientReplicator:get_server_entity(entity) then rememberBond(entity, now) end end for _, model in CollectionService:GetTagged("ModelInstance") do local serverEntity: number? = model:GetAttribute("entity_server") local bond = serverEntity and bonds[serverEntity] if bond then bond.model = model end end if count ~= remaining then lastProgress = now end remaining = count nextScan = now + 0.2 end local function bondExists(bond: Bond, entity: number?): boolean local model = bond.model return (entity ~= nil and World:contains(entity)) or World:contains(bond.entity) or (model ~= nil and model.Parent ~= nil and model:GetAttribute("entity_server") == bond.serverEntity) end local function isPending(bond: Bond, now: number, exists: boolean): boolean return exists or contents[bond.serverEntity] == true or bond.stage ~= "collecting" or bond.attempts == 0 or bond.missingSince == nil or now - bond.missingSince < MISSING_INTERVAL end local function canInteract(entity: number) return not World:has(entity, Components.Welded) and World:target(entity, Components.ShopProperty) == nil and hasInteractionPermission(characterEntity, entity) end while running do local now = os.clock() local clientState = World:get( Components.ClientStateResource, Components.ClientStateResource ) local currentCharacter = clientState and clientState.localCharacter local character = player.Character local humanoid = character and character:FindFirstChildOfClass("Humanoid") local ready = ReplicatedStorage:GetAttribute("LoadingText") == "" and currentCharacter ~= nil and World:contains(currentCharacter) and World:get(currentCharacter, Components.ModelInstance) == character and humanoid ~= nil and humanoid.Health > 0 and PlayerDataController.hasLoaded() if not ready then readySince = nil emptySince = nil notice.hide() lastProgress = now if now - lastReadyAt > 90 then error("Map, character or player data did not become ready.") end task.wait(POLL_INTERVAL) continue end if currentCharacter ~= characterEntity then characterEntity = currentCharacter lastProgress = now emptySince = nil nextScan = 0 readySince = nil end lastReadyAt = now readySince = readySince or now local balance: number = PlayerDataController.getReplica().Data.bonds assert(type(balance) == "number", "Replicated bond balance is unavailable.") firstBalance = firstBalance or balance if balance ~= lastBalance then lastBalance = balance lastProgress = now emptySince = nil end if now >= nextScan then scan(now) end if lobbySentAt then notice.departing(balance - firstBalance) if now - lobbySentAt >= 15 then error("Lobby return was not confirmed.") end task.wait(POLL_INTERVAL) continue end local sackEntity = findFirstChildWith(characterEntity, Components.Sack) local sack = sackEntity and World:get(sackEntity, Components.Sack) table.clear(contents) if sack then for _, serverEntity in sack.contents do contents[serverEntity] = true end end local collectBond: Bond? local storeBond: Bond? local unstoreBond: Bond? local pendingStores = 0 local pendingSack = false local pendingCount = 0 for _ in unmapped do pendingCount += 1 end local canAct = not capabilityLocks.isLocked(Capability.Interact) local collectAt = math.max( nextCollect, if lastCollect then lastCollect + MIN_REQUEST_GAP else 0 ) local storeAt = math.max( nextStore, if lastStore then lastStore + MIN_REQUEST_GAP else 0 ) local collectReady = now + 1e-6 >= collectAt and collectBucket.tokens > 0 local storeReady = now + 1e-6 >= storeAt and storeBucket.tokens > 0 for serverEntity, bond in bonds do local entity = ClientReplicator:get_client_entity(serverEntity) local present = entity ~= nil and World:get(entity, Components.ObjectId) == "bond" local exists = bondExists(bond, entity) local inSack = contents[serverEntity] == true if inSack and bond.stage ~= "unstoring" and bond.stage ~= "unstore" then bond.usedSack = true bond.sackEntity = sackEntity setStage(bond, "unstore", now) elseif bond.stage == "unstoring" and not inSack and sackEntity == bond.sackEntity then setStage(bond, "collect", now) elseif not exists and not inSack then bond.missingSince = bond.missingSince or now else bond.missingSince = nil end if bond.stage == "storing" or bond.stage == "unstoring" then if now - bond.stageSince >= 8 then error(("Sack change not confirmed for bond %s."):format(tostring(serverEntity))) end if bond.stage == "storing" and not inSack then pendingStores += 1 end elseif bond.stage == "collecting" and present and now - bond.stageSince >= 1.5 then if not bond.usedSack and sack and World:has(entity, Components.Storable) then setStage(bond, "store", now) elseif bond.attempts < 3 then setStage(bond, "collect", now) else setStage(bond, "blocked", now) end end if bond.stage == "storing" or bond.stage == "unstoring" or bond.stage == "unstore" then pendingSack = true end if isPending(bond, now, exists) then pendingCount += 1 end if canAct and present and not inSack then if collectReady and bond.stage == "collect" and (not collectBond or bond.order < collectBond.order) and World:has(entity, Components.Actionable) and canInteract(entity) then bond.entity = entity collectBond = bond elseif storeReady and bond.stage == "store" and (not storeBond or bond.order < storeBond.order) and World:has(entity, Components.Storable) and canInteract(entity) then bond.entity = entity storeBond = bond end end if storeReady and canAct and inSack and bond.stage == "unstore" then if not unstoreBond or bond.order < unstoreBond.order then unstoreBond = bond end end end if storeReady then local bond = unstoreBond if not bond and sack and #sack.contents + pendingStores < sack.maxContents then bond = storeBond end if bond then local serverEntity = bond.serverEntity local inSack = contents[serverEntity] == true if inSack or ClientReplicator:get_server_entity(bond.entity) == serverEntity then local sentAt = os.clock() bond.sackEntity = sackEntity setStage(bond, inSack and "unstoring" or "storing", sentAt) Remotes.Store:FireServer(serverEntity) lastStore = sentAt local nextAt = nextStore + REQUEST_INTERVAL nextStore = if nextAt > sentAt then nextAt else sentAt + REQUEST_INTERVAL storeAt = math.max(nextStore, sentAt + MIN_REQUEST_GAP) pendingSack = true end end end if collectBond and collectReady then local serverEntity = ClientReplicator:get_server_entity(collectBond.entity) if serverEntity then local sentAt = os.clock() collectBond.attempts += 1 setStage(collectBond, "collecting", sentAt) Remotes.Actionable:FireServer(serverEntity) lastCollect = sentAt local nextAt = nextCollect + REQUEST_INTERVAL nextCollect = if nextAt > sentAt then nextAt else sentAt + REQUEST_INTERVAL collectAt = math.max(nextCollect, sentAt + MIN_REQUEST_GAP) end end local canReturn = remaining == 0 and pendingCount == 0 and not pendingSack and order > 0 and balance > firstBalance and now - readySince >= READY_INTERVAL if canReturn then emptySince = emptySince or now local returnAt = math.max(emptySince, lastProgress) + 5 notice.show(balance - firstBalance, returnAt) if now >= returnAt then scan(now) local pending = next(unmapped) ~= nil for serverEntity, bond in bonds do local entity = ClientReplicator:get_client_entity(serverEntity) if isPending(bond, now, bondExists(bond, entity)) then pending = true break end end if remaining == 0 and not pending and now - lastProgress >= 5 then print(("%s Bond balance: %d (%+d during this run)."):format( PREFIX, balance, balance - firstBalance )) print(PREFIX .. " No remaining bonds found. Returning to lobby.") lobbySentAt = now notice.departing(balance - firstBalance) returnToLobby:FireServer() end end else emptySince = nil notice.hide() end if now - lastProgress >= 30 and reportedProgress ~= lastProgress then reportedProgress = lastProgress print(("%s Waiting for bond updates (%d found, %d pending, %+d earned)."):format( PREFIX, remaining, pendingCount, balance - firstBalance )) end now = os.clock() local waitFor = 0.025 if collectBucket.tokens > 0 and collectAt > now then waitFor = math.min(waitFor, collectAt - now) end if storeBucket.tokens > 0 and storeAt > now then waitFor = math.min(waitFor, storeAt - now) end task.wait(waitFor) end return nil end worker = task.spawn(function() local completed, problem = xpcall(run, function(message) return debug.traceback(tostring(message), 2) end) if not completed or problem then stop(queued) warn(PREFIX .. " " .. tostring(problem)) end end) ]=====] local startup = [======[ if not game:IsLoaded() then game.Loaded:Wait() end local Players = game:GetService("Players") local player = Players.LocalPlayer while not player do Players:GetPropertyChangedSignal("LocalPlayer"):Wait() player = Players.LocalPlayer end local PREFIX = "[YS Dead Rails]" assert( game.PlaceId == 70876832253163 or game.PlaceId == 116495829188952, PREFIX .. " Run this in the Dead Rails lobby or match." ) local previous = player:FindFirstChild("YS Dead Rails") local ownsPrevious = previous and previous:IsA("BindableFunction") and previous:GetAttribute("Purpose") == "Collect bonds" if fromTeleport and ownsPrevious and previous:GetAttribute("Running") == true then return end local function showExecutorNotice(playerGui: PlayerGui, executorName: string, missing: { string }) for _, previous in playerGui:GetChildren() do if previous.Name == "YS Dead Rails executor notice" and previous:IsA("ScreenGui") and previous:GetAttribute("Purpose") == "Executor support" then previous:Destroy() end end local GuiService = game:GetService("GuiService") local TextService = game:GetService("TextService") local gui = Instance.new("ScreenGui") gui.Name = "YS Dead Rails executor notice" gui:SetAttribute("Purpose", "Executor support") gui.ResetOnSpawn = false gui.ScreenInsets = Enum.ScreenInsets.CoreUISafeInsets gui.ClipToDeviceSafeArea = true gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.DisplayOrder = 60 gui.Enabled = false local bounds = Instance.new("Frame") bounds.Name = "Bounds" bounds.BackgroundTransparency = 1 bounds.Size = UDim2.fromScale(1, 1) bounds.Active = false bounds.Parent = gui local panel = Instance.new("CanvasGroup") panel.Name = "Unsupported executor" panel.AnchorPoint = Vector2.new(1, 1) panel.Position = UDim2.new(1, -16, 1, -16) panel.Size = UDim2.new(1, -32, 0, 140) panel.BackgroundColor3 = Color3.fromRGB(24, 27, 29) panel.BorderSizePixel = 0 panel.Active = false panel.Interactable = false panel.Parent = bounds local limit = Instance.new("UISizeConstraint") limit.MinSize = Vector2.new(0, 0) limit.MaxSize = Vector2.new(328, 500) limit.Parent = panel local scale = Instance.new("UIScale") scale.Parent = panel local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 5) corner.Parent = panel local border = Instance.new("UIStroke") border.Color = Color3.fromRGB(53, 59, 62) border.Thickness = 1 border.BorderStrokePosition = Enum.BorderStrokePosition.Inner border.ApplyStrokeMode = Enum.ApplyStrokeMode.Border border.Parent = panel local content = Instance.new("Frame") content.Name = "Content" content.BackgroundTransparency = 1 content.BorderSizePixel = 0 content.Position = UDim2.fromOffset(16, 16) content.Size = UDim2.new(1, -32, 1, -32) content.Active = false content.Parent = panel local rows = Instance.new("UIListLayout") rows.FillDirection = Enum.FillDirection.Vertical rows.SortOrder = Enum.SortOrder.LayoutOrder rows.Padding = UDim.new(0, 8) rows.Parent = content local function label(name: string, text: string, order: number) local value = Instance.new("TextLabel") value.Name = name value.Text = text value.Font = Enum.Font.GothamMedium value.TextColor3 = Color3.fromRGB(175, 185, 180) value.TextXAlignment = Enum.TextXAlignment.Left value.TextYAlignment = Enum.TextYAlignment.Top value.TextWrapped = true value.TextScaled = false value.RichText = false value.BackgroundTransparency = 1 value.BorderSizePixel = 0 value.LayoutOrder = order value.Active = false value.Parent = content return value end local name = executorName:gsub("%c", " ") local nameLength = utf8.len(name) or 0 if nameLength > 32 then name = name:sub(1, (utf8.offset(name, 33) :: number) - 1) end local title = label("Title", "", 1) title.TextColor3 = Color3.fromRGB(237, 240, 238) local message = label( "Message", "Sorry, your executor is missing capabilities required to run YS Dead Rails.", 2 ) local detail = label("Missing", "Missing: " .. table.concat(missing, ", "), 3) local textSizes = { [Enum.PreferredTextSize.Medium] = 1, [Enum.PreferredTextSize.Large] = 1.15, [Enum.PreferredTextSize.Larger] = 1.3, [Enum.PreferredTextSize.Largest] = 1.5, } local function layout() local size = bounds.AbsoluteSize if size.X <= 32 or size.Y <= 32 then return end local textSize = textSizes[GuiService.PreferredTextSize] or 1 local uiScale = math.clamp(math.min(size.X / 1280, size.Y / 720), 1, 1.6) if GuiService:IsTenFootInterface() then uiScale = math.max(uiScale, 1.3) end local width = math.min(328, (size.X - 32) / uiScale) local available = (size.Y - 32) / uiScale scale.Scale = uiScale title.TextSize = math.round(16 * textSize) message.TextSize = math.round(13 * textSize) detail.TextSize = math.round(12 * textSize) local shownName = name title.Text = shownName .. (if nameLength > 32 then "…" else "") .. " is not supported" local function measure(value: TextLabel) return math.ceil(TextService:GetTextSize( value.Text, value.TextSize, value.Font, Vector2.new(width - 32, 1000) ).Y) + 2 end local titleHeight = measure(title) local messageHeight = measure(message) local detailHeight = measure(detail) local height = 32 + titleHeight + 8 + messageHeight while height > available and (utf8.len(shownName) :: number) > 4 do shownName = shownName:sub(1, (utf8.offset(shownName, -1) :: number) - 1) title.Text = shownName .. "… is not supported" titleHeight = measure(title) height = 32 + titleHeight + 8 + messageHeight end detail.Visible = #missing > 0 and height + 8 + detailHeight <= available if detail.Visible then height += 8 + detailHeight end title.Size = UDim2.new(1, 0, 0, titleHeight) message.Size = UDim2.new(1, 0, 0, messageHeight) detail.Size = UDim2.new(1, 0, 0, detailHeight) panel.Size = UDim2.new(1 / uiScale, -32 / uiScale, 0, height) local bottom = 16 local touchGui = playerGui:FindFirstChild("TouchGui") :: ScreenGui? local controls = touchGui and touchGui:FindFirstChild("TouchControlFrame") local jump = controls and controls:FindFirstChild("JumpButton") :: GuiObject? if touchGui and touchGui.Enabled and jump and jump.Visible then local safeBottom = bounds.AbsolutePosition.Y + size.Y bottom = math.max(bottom, safeBottom - jump.AbsolutePosition.Y + 12) end bottom = math.min(bottom, math.max(16, size.Y - height * uiScale - 12)) panel.Position = UDim2.new(1, -16, 1, -bottom) gui.Enabled = true end local connections = {} local dismiss: thread? local closed = false local function cleanup() if closed then return end closed = true for _, connection in connections do connection:Disconnect() end if dismiss and dismiss ~= coroutine.running() and coroutine.status(dismiss) ~= "dead" then task.cancel(dismiss) end end local function close() if closed then return end cleanup() gui:Destroy() end connections[1] = gui.Destroying:Connect(cleanup) connections[2] = bounds:GetPropertyChangedSignal("AbsoluteSize"):Connect(layout) connections[3] = bounds:GetPropertyChangedSignal("AbsolutePosition"):Connect(layout) connections[4] = GuiService:GetPropertyChangedSignal("PreferredTextSize"):Connect(layout) gui.Parent = playerGui layout() dismiss = task.delay(10, close) return close end local executorName = "Your executor" local identify = identifyexecutor if type(identify) ~= "function" then identify = getexecutorname end if type(identify) == "function" then local identified, name = pcall(identify) if identified and type(name) == "string" then name = name:gsub("%c", " "):match("^%s*(.-)%s*$") if name and name ~= "" and utf8.len(name) then executorName = name end end end local queueTeleport = queueonteleport if type(queueTeleport) ~= "function" then queueTeleport = queue_on_teleport end if type(queueTeleport) ~= "function" and type(syn) == "table" then queueTeleport = syn.queue_on_teleport end if type(queueTeleport) ~= "function" and type(fluxus) == "table" then queueTeleport = fluxus.queue_on_teleport end local missing = {} if type(loadstring) ~= "function" then table.insert(missing, "script compilation") end if type(queueTeleport) ~= "function" then table.insert(missing, "teleport continuation") end if #missing > 0 then if ownsPrevious then local bonds, nextCollect, nextStore, run = previous:Invoke() local collector = Instance.new("BindableFunction") collector.Name = "YS Dead Rails" collector:SetAttribute("Purpose", "Collect bonds") collector:SetAttribute("Running", false) collector.OnInvoke = function() collector:Destroy() return bonds, nextCollect, nextStore, run end collector.Parent = player print(PREFIX .. " Previous instance cleared. Waiting for executor support.") end local playerGui = player:WaitForChild("PlayerGui", 30) assert(playerGui, PREFIX .. " PlayerGui did not load.") showExecutorNotice(playerGui, executorName, missing) return end local run, problem = loadstring(source, "YS Dead Rails") assert(run, PREFIX .. " " .. tostring(problem)) local playerGui = player:FindFirstChild("PlayerGui") if playerGui then for _, child in playerGui:GetChildren() do if child.Name == "YS Dead Rails executor notice" and child:IsA("ScreenGui") and child:GetAttribute("Purpose") == "Executor support" then child:Destroy() end end end run(source, startup, fromTeleport, queueTeleport, player) ]======] local fromTeleport = false if not game:IsLoaded() then game.Loaded:Wait() end local Players = game:GetService("Players") local player = Players.LocalPlayer while not player do Players:GetPropertyChangedSignal("LocalPlayer"):Wait() player = Players.LocalPlayer end local PREFIX = "[YS Dead Rails]" assert( game.PlaceId == 70876832253163 or game.PlaceId == 116495829188952, PREFIX .. " Run this in the Dead Rails lobby or match." ) local previous = player:FindFirstChild("YS Dead Rails") local ownsPrevious = previous and previous:IsA("BindableFunction") and previous:GetAttribute("Purpose") == "Collect bonds" if fromTeleport and ownsPrevious and previous:GetAttribute("Running") == true then return end local function showExecutorNotice(playerGui: PlayerGui, executorName: string, missing: { string }) for _, previous in playerGui:GetChildren() do if previous.Name == "YS Dead Rails executor notice" and previous:IsA("ScreenGui") and previous:GetAttribute("Purpose") == "Executor support" then previous:Destroy() end end local GuiService = game:GetService("GuiService") local TextService = game:GetService("TextService") local gui = Instance.new("ScreenGui") gui.Name = "YS Dead Rails executor notice" gui:SetAttribute("Purpose", "Executor support") gui.ResetOnSpawn = false gui.ScreenInsets = Enum.ScreenInsets.CoreUISafeInsets gui.ClipToDeviceSafeArea = true gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.DisplayOrder = 60 gui.Enabled = false local bounds = Instance.new("Frame") bounds.Name = "Bounds" bounds.BackgroundTransparency = 1 bounds.Size = UDim2.fromScale(1, 1) bounds.Active = false bounds.Parent = gui local panel = Instance.new("CanvasGroup") panel.Name = "Unsupported executor" panel.AnchorPoint = Vector2.new(1, 1) panel.Position = UDim2.new(1, -16, 1, -16) panel.Size = UDim2.new(1, -32, 0, 140) panel.BackgroundColor3 = Color3.fromRGB(24, 27, 29) panel.BorderSizePixel = 0 panel.Active = false panel.Interactable = false panel.Parent = bounds local limit = Instance.new("UISizeConstraint") limit.MinSize = Vector2.new(0, 0) limit.MaxSize = Vector2.new(328, 500) limit.Parent = panel local scale = Instance.new("UIScale") scale.Parent = panel local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 5) corner.Parent = panel local border = Instance.new("UIStroke") border.Color = Color3.fromRGB(53, 59, 62) border.Thickness = 1 border.BorderStrokePosition = Enum.BorderStrokePosition.Inner border.ApplyStrokeMode = Enum.ApplyStrokeMode.Border border.Parent = panel local content = Instance.new("Frame") content.Name = "Content" content.BackgroundTransparency = 1 content.BorderSizePixel = 0 content.Position = UDim2.fromOffset(16, 16) content.Size = UDim2.new(1, -32, 1, -32) content.Active = false content.Parent = panel local rows = Instance.new("UIListLayout") rows.FillDirection = Enum.FillDirection.Vertical rows.SortOrder = Enum.SortOrder.LayoutOrder rows.Padding = UDim.new(0, 8) rows.Parent = content local function label(name: string, text: string, order: number) local value = Instance.new("TextLabel") value.Name = name value.Text = text value.Font = Enum.Font.GothamMedium value.TextColor3 = Color3.fromRGB(175, 185, 180) value.TextXAlignment = Enum.TextXAlignment.Left value.TextYAlignment = Enum.TextYAlignment.Top value.TextWrapped = true value.TextScaled = false value.RichText = false value.BackgroundTransparency = 1 value.BorderSizePixel = 0 value.LayoutOrder = order value.Active = false value.Parent = content return value end local name = executorName:gsub("%c", " ") local nameLength = utf8.len(name) or 0 if nameLength > 32 then name = name:sub(1, (utf8.offset(name, 33) :: number) - 1) end local title = label("Title", "", 1) title.TextColor3 = Color3.fromRGB(237, 240, 238) local message = label( "Message", "Sorry, your executor is missing capabilities required to run YS Dead Rails.", 2 ) local detail = label("Missing", "Missing: " .. table.concat(missing, ", "), 3) local textSizes = { [Enum.PreferredTextSize.Medium] = 1, [Enum.PreferredTextSize.Large] = 1.15, [Enum.PreferredTextSize.Larger] = 1.3, [Enum.PreferredTextSize.Largest] = 1.5, } local function layout() local size = bounds.AbsoluteSize if size.X <= 32 or size.Y <= 32 then return end local textSize = textSizes[GuiService.PreferredTextSize] or 1 local uiScale = math.clamp(math.min(size.X / 1280, size.Y / 720), 1, 1.6) if GuiService:IsTenFootInterface() then uiScale = math.max(uiScale, 1.3) end local width = math.min(328, (size.X - 32) / uiScale) local available = (size.Y - 32) / uiScale scale.Scale = uiScale title.TextSize = math.round(16 * textSize) message.TextSize = math.round(13 * textSize) detail.TextSize = math.round(12 * textSize) local shownName = name title.Text = shownName .. (if nameLength > 32 then "…" else "") .. " is not supported" local function measure(value: TextLabel) return math.ceil(TextService:GetTextSize( value.Text, value.TextSize, value.Font, Vector2.new(width - 32, 1000) ).Y) + 2 end local titleHeight = measure(title) local messageHeight = measure(message) local detailHeight = measure(detail) local height = 32 + titleHeight + 8 + messageHeight while height > available and (utf8.len(shownName) :: number) > 4 do shownName = shownName:sub(1, (utf8.offset(shownName, -1) :: number) - 1) title.Text = shownName .. "… is not supported" titleHeight = measure(title) height = 32 + titleHeight + 8 + messageHeight end detail.Visible = #missing > 0 and height + 8 + detailHeight <= available if detail.Visible then height += 8 + detailHeight end title.Size = UDim2.new(1, 0, 0, titleHeight) message.Size = UDim2.new(1, 0, 0, messageHeight) detail.Size = UDim2.new(1, 0, 0, detailHeight) panel.Size = UDim2.new(1 / uiScale, -32 / uiScale, 0, height) local bottom = 16 local touchGui = playerGui:FindFirstChild("TouchGui") :: ScreenGui? local controls = touchGui and touchGui:FindFirstChild("TouchControlFrame") local jump = controls and controls:FindFirstChild("JumpButton") :: GuiObject? if touchGui and touchGui.Enabled and jump and jump.Visible then local safeBottom = bounds.AbsolutePosition.Y + size.Y bottom = math.max(bottom, safeBottom - jump.AbsolutePosition.Y + 12) end bottom = math.min(bottom, math.max(16, size.Y - height * uiScale - 12)) panel.Position = UDim2.new(1, -16, 1, -bottom) gui.Enabled = true end local connections = {} local dismiss: thread? local closed = false local function cleanup() if closed then return end closed = true for _, connection in connections do connection:Disconnect() end if dismiss and dismiss ~= coroutine.running() and coroutine.status(dismiss) ~= "dead" then task.cancel(dismiss) end end local function close() if closed then return end cleanup() gui:Destroy() end connections[1] = gui.Destroying:Connect(cleanup) connections[2] = bounds:GetPropertyChangedSignal("AbsoluteSize"):Connect(layout) connections[3] = bounds:GetPropertyChangedSignal("AbsolutePosition"):Connect(layout) connections[4] = GuiService:GetPropertyChangedSignal("PreferredTextSize"):Connect(layout) gui.Parent = playerGui layout() dismiss = task.delay(10, close) return close end local executorName = "Your executor" local identify = identifyexecutor if type(identify) ~= "function" then identify = getexecutorname end if type(identify) == "function" then local identified, name = pcall(identify) if identified and type(name) == "string" then name = name:gsub("%c", " "):match("^%s*(.-)%s*$") if name and name ~= "" and utf8.len(name) then executorName = name end end end local queueTeleport = queueonteleport if type(queueTeleport) ~= "function" then queueTeleport = queue_on_teleport end if type(queueTeleport) ~= "function" and type(syn) == "table" then queueTeleport = syn.queue_on_teleport end if type(queueTeleport) ~= "function" and type(fluxus) == "table" then queueTeleport = fluxus.queue_on_teleport end local missing = {} if type(loadstring) ~= "function" then table.insert(missing, "script compilation") end if type(queueTeleport) ~= "function" then table.insert(missing, "teleport continuation") end if #missing > 0 then if ownsPrevious then local bonds, nextCollect, nextStore, run = previous:Invoke() local collector = Instance.new("BindableFunction") collector.Name = "YS Dead Rails" collector:SetAttribute("Purpose", "Collect bonds") collector:SetAttribute("Running", false) collector.OnInvoke = function() collector:Destroy() return bonds, nextCollect, nextStore, run end collector.Parent = player print(PREFIX .. " Previous instance cleared. Waiting for executor support.") end local playerGui = player:WaitForChild("PlayerGui", 30) assert(playerGui, PREFIX .. " PlayerGui did not load.") showExecutorNotice(playerGui, executorName, missing) return end local run, problem = loadstring(source, "YS Dead Rails") assert(run, PREFIX .. " " .. tostring(problem)) local playerGui = player:FindFirstChild("PlayerGui") if playerGui then for _, child in playerGui:GetChildren() do if child.Name == "YS Dead Rails executor notice" and child:IsA("ScreenGui") and child:GetAttribute("Purpose") == "Executor support" then child:Destroy() end end end run(source, startup, fromTeleport, queueTeleport, player)