-- Load Rayfield UI Library local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))() local Players = game:GetService("Players") local VirtualUser = game:GetService("VirtualUser") local player = Players.LocalPlayer -- State Management local isAutoTeleportEnabled = false local animationThread = nil local antiAfkConnection = nil -- Anti-AFK Setup antiAfkConnection = player.Idled:Connect(function() VirtualUser:CaptureController() VirtualUser:ClickButton2(Vector2.new()) print("Anti-AFK triggered to prevent kick.") end) -- Create Rayfield Window local Window = Rayfield:CreateWindow({ Name = "Safety NOT required hub", LoadingTitle = "Loading script...", LoadingSubtitle = "by Anonymous", ConfigurationSaving = { Enabled = false }, Discord = { Enabled = false }, KeySystem = false }) -- Send Rayfield Native Notification Rayfield:Notify({ Title = "Anti afk enabled", Content = "Anti afk has been enabled, meaning you wont get kicked for being afk", Duration = 5, Image = 4483362458 -- Bell Icon }) -- Fullscreen Black Overlay Setup local overlayGui = Instance.new("ScreenGui") overlayGui.Name = "AutofarmOverlay" overlayGui.ResetOnSpawn = false overlayGui.DisplayOrder = 9999 overlayGui.Parent = player:WaitForChild("PlayerGui") local overlayFrame = Instance.new("Frame") overlayFrame.Name = "OverlayFrame" overlayFrame.Size = UDim2.new(1, 0, 1, 0) overlayFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) overlayFrame.BorderSizePixel = 0 overlayFrame.Visible = false overlayFrame.Parent = overlayGui local statusText = Instance.new("TextLabel") statusText.Name = "StatusText" statusText.Size = UDim2.new(1, 0, 0, 100) statusText.Position = UDim2.new(0, 0, 0.45, 0) statusText.BackgroundTransparency = 1 statusText.TextColor3 = Color3.fromRGB(255, 255, 255) statusText.Text = "Autofarming." statusText.Font = Enum.Font.SourceSansBold statusText.TextSize = 36 statusText.Parent = overlayFrame -- Loading Dots Animation local function startDotAnimation() if animationThread then task.cancel(animationThread) end animationThread = task.spawn(function() local dots = 1 while isAutoTeleportEnabled do statusText.Text = "Autofarming" .. string.rep(".", dots) dots = (dots % 3) + 1 task.wait(0.5) end end) end -- Nearest Entity Search local function findNearestCFrame(searchFunction) local character = player.Character if not character then return nil end local hrp = character:FindFirstChild("HumanoidRootPart") if not hrp then return nil end local entitiesFolder = workspace:FindFirstChild("map") and workspace.map:FindFirstChild("entities") if not entitiesFolder then warn("Could not find workspace.map.entities") return nil end local nearestCFrame = nil local shortestDistance = math.huge for _, object in ipairs(entitiesFolder:GetDescendants()) do if searchFunction(object) then local targetCFrame = object:IsA("BasePart") and object.CFrame or (object:IsA("Model") and object:GetPivot()) if targetCFrame then local distance = (hrp.Position - targetCFrame.Position).Magnitude if distance < shortestDistance then shortestDistance = distance nearestCFrame = targetCFrame end end end end return nearestCFrame end -- Teleport Actions local function teleportToBobux() local character = player.Character or player.CharacterAdded:Wait() local hrp = character:WaitForChild("HumanoidRootPart") local bobuxCFrame = findNearestCFrame(function(obj) return obj.Name == "bobux" end) if bobuxCFrame then hrp.CFrame = bobuxCFrame + Vector3.new(0, 3, 0) print("Teleported to bobux!") else warn("No bobux found!") end end local function teleportToExit() local character = player.Character or player.CharacterAdded:Wait() local hrp = character:WaitForChild("HumanoidRootPart") local exitCFrame = findNearestCFrame(function(obj) return obj.Name == "spawn" and obj.Parent and obj.Parent.Name == "exit" end) if exitCFrame then hrp.CFrame = exitCFrame + Vector3.new(0, 3, 0) print("Teleported to exit spawn!") else warn("No exit.spawn found!") end end local function runTeleportSequence() teleportToBobux() task.wait(0.2) teleportToExit() end -- Respawn Listener player.CharacterAdded:Connect(function(character) if not isAutoTeleportEnabled then return end character:WaitForChild("HumanoidRootPart") task.wait(3) if isAutoTeleportEnabled then runTeleportSequence() end end) -- Tabs local FarmingTab = Window:CreateTab("Farming", "aperture") local MiscTab = Window:CreateTab("Misc", "settings") -- Farming Tab Controls FarmingTab:CreateToggle({ Name = "Auto-Teleport", CurrentValue = false, Flag = "AutoTeleportToggle", Callback = function(Value) isAutoTeleportEnabled = Value overlayFrame.Visible = Value if Value then startDotAnimation() if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then task.spawn(runTeleportSequence) end else if animationThread then task.cancel(animationThread) animationThread = nil end end end, }) FarmingTab:CreateButton({ Name = "Get the bobux", Callback = function() teleportToBobux() end, }) FarmingTab:CreateButton({ Name = "Teleport to the exit", Callback = function() teleportToExit() end, }) FarmingTab:CreateButton({ Name = "Get bobux and exit", Callback = function() task.spawn(runTeleportSequence) end, }) -- Misc Tab Controls MiscTab:CreateButton({ Name = "Close GUI", Callback = function() isAutoTeleportEnabled = false if antiAfkConnection then antiAfkConnection:Disconnect() antiAfkConnection = nil end if animationThread then task.cancel(animationThread) animationThread = nil end overlayGui:Destroy() Rayfield:Destroy() print("Rayfield closed and Anti-AFK disabled.") end, })