Auto Dungeon Auto Attack Open source
Key Required

Auto Dungeon Auto Attack Open source

[🔥NEW!] Anime SagaRellRell 3.7K views 6 executesUpdated May 18, 2025
0.0/ 5(1 votes)
010% Positive
Lua Script•612 lines (26570 chars)
-- Anime Saga Script --
-- Sistem kontrol log lokal
local LogSystem = {
    Enabled = true, -- Default aktifkan log
    WarningsEnabled = true -- Default aktifkan juga peringatan
}

-- Timpa fungsi print untuk mengontrol log
local originalPrint = print
print = function(...)
    if LogSystem.Enabled then
        originalPrint(...)
    end
end

-- Timpa fungsi warn untuk mengontrol peringatan
local originalWarn = warn
warn = function(...)
    if LogSystem.WarningsEnabled then
        originalWarn(...)
    end
end

-- Layanan Roblox yang sering digunakan
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer or Players.PlayerAdded:Wait()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")

-- Muat pustaka Fluent
local Fluent, SaveManager, InterfaceManager
local success, err = pcall(function()
    Fluent = loadstring(game:HttpGet("https://github.com/dawid-scripts/Fluent/releases/latest/download/main.lua"))()
    SaveManager = loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/master/Addons/SaveManager.lua"))()
    InterfaceManager = loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/master/Addons/InterfaceManager.lua"))()
end)

if not success then
    warn("Kesalahan saat memuat pustaka Fluent: " .. tostring(err))
    -- Coba muat dari URL cadangan
    local success_backup, err_backup = pcall(function()
        Fluent = loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/master/Fluent.lua"))()
        SaveManager = loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/master/Addons/SaveManager.lua"))()
        InterfaceManager = loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/master/Addons/InterfaceManager.lua"))()
    end)
    if not success_backup then
        warn("Kesalahan saat memuat pustaka Fluent dari URL cadangan: " .. tostring(err_backup))
    end
end

if not Fluent then
    error("Tidak dapat memuat pustaka Fluent. Harap periksa koneksi internet atau executor Anda.")
    return
end

-- Fungsi utilitas untuk memeriksa dan mendapatkan service/objek dengan aman
local function safeGetService(serviceName)
    local s, res = pcall(function() return game:GetService(serviceName) end)
    return s and res or nil
end

-- Fungsi utilitas untuk memeriksa dan mendapatkan child dengan aman
local function safeGetChild(parent, childName, waitTime)
    if not parent then return nil end
    local child = parent:FindFirstChild(childName)
    if not child and waitTime and waitTime > 0 then
        local s, res = pcall(function() return parent:WaitForChild(childName, waitTime) end)
        if s then child = res end
    end
    return child
end

-- Sistem penyimpanan konfigurasi
local ConfigSystem = {}
ConfigSystem.FileName = "AnimeSagaConfig_" .. LocalPlayer.Name .. ".json"
ConfigSystem.DefaultConfig = {
    -- Pengaturan UI
    UITheme = "Amethyst",
    -- Pengaturan log
    LogsEnabled = true,
    WarningsEnabled = true,
    -- Pengaturan Auto Play (dari Skrip 1)
    AutoPlayEnabled = false,
    AutoFollowEnemy = false,
    AutoCombat = false,
    AutoSkill1 = false,
    AutoSkill2 = false,
    AutoSkill3 = false,
    -- Pengaturan Story (dari Skrip 2)
    SelectedMap = 1,
    SelectedAct = 1,
    SelectedDifficulty = 1,
    AutoJoinStory = false,
}
ConfigSystem.CurrentConfig = {} -- Cache untuk ConfigSystem guna mengurangi I/O
ConfigSystem.LastSaveTime = 0
ConfigSystem.SaveCooldown = 2 -- 2 detik antar penyimpanan
ConfigSystem.PendingSave = false -- Tandai untuk penyimpanan yang tertunda

-- Fungsi untuk menyimpan konfigurasi
ConfigSystem.SaveConfig = function()
    local currentTime = os.time()
    if currentTime - ConfigSystem.LastSaveTime < ConfigSystem.SaveCooldown then
        ConfigSystem.PendingSave = true
        return
    end
    local s, e = pcall(function()
        writefile(ConfigSystem.FileName, HttpService:JSONEncode(ConfigSystem.CurrentConfig))
    end)
    if s then
        ConfigSystem.LastSaveTime = currentTime
        ConfigSystem.PendingSave = false
    else
        warn("Gagal menyimpan konfigurasi:", e)
    end
end

-- Fungsi untuk memuat konfigurasi
ConfigSystem.LoadConfig = function()
    local s_read, content = pcall(function()
        if isfile(ConfigSystem.FileName) then
            return readfile(ConfigSystem.FileName)
        end
        return nil
    end)
    if s_read and content then
        local s_decode, data = pcall(function()
            return HttpService:JSONDecode(content)
        end)
        if s_decode and data then
            for key, value in pairs(ConfigSystem.DefaultConfig) do
                if data[key] == nil then
                    data[key] = value
                end
            end
            ConfigSystem.CurrentConfig = data
            if data.LogsEnabled ~= nil then LogSystem.Enabled = data.LogsEnabled end
            if data.WarningsEnabled ~= nil then LogSystem.WarningsEnabled = data.WarningsEnabled end
            return true
        end
    end
    ConfigSystem.CurrentConfig = table.clone(ConfigSystem.DefaultConfig)
    ConfigSystem.SaveConfig() -- Simpan default jika gagal memuat atau file tidak ada
    return false
end

-- Timer untuk menyimpan secara berkala jika ada perubahan yang belum disimpan
spawn(function()
    while task.wait(5) do
        if ConfigSystem.PendingSave then
            ConfigSystem.SaveConfig()
        end
    end
end)

-- Muat konfigurasi saat startup
ConfigSystem.LoadConfig()

-- Informasi pemain
local playerName = LocalPlayer.Name

-- Variabel terkait karakter (akan diinisialisasi setelah karakter dimuat)
local character
local humanoidRootPart
local humanoid
local camera = workspace.CurrentCamera

local function initializeCharacterDependentVariables()
    character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
    humanoidRootPart = character:WaitForChild("HumanoidRootPart", 10)
    humanoid = character:WaitForChild("Humanoid", 10)
    if humanoid then
        camera.CameraSubject = humanoid
        camera.CameraType = Enum.CameraType.Custom
    end
end
initializeCharacterDependentVariables() -- Panggil sekali saat startup

LocalPlayer.CharacterAdded:Connect(function(char)
    character = char
    humanoidRootPart = char:WaitForChild("HumanoidRootPart", 10)
    humanoid = char:WaitForChild("Humanoid", 10)
    if humanoid then
        camera.CameraSubject = humanoid
        camera.CameraType = Enum.CameraType.Custom
    end
end)


-- Buat Window
local Window = Fluent:CreateWindow({
    Title = "x2zu | Anime Saga",
    SubTitle = "Combined Script",
    TabWidth = 160, -- Sedikit lebih lebar untuk mengakomodasi lebih banyak tab
    Size = UDim2.fromOffset(500, 400), -- Sedikit lebih besar
    Acrylic = true,
    Theme = ConfigSystem.CurrentConfig.UITheme or "Dark",
    MinimizeKey = Enum.KeyCode.LeftControl
})

-- Tab-tab
local InfoTab = Window:AddTab({ Title = "Info", Icon = "rbxassetid://7733964719" })
local PlayTab = Window:AddTab({ Title = "Play (Story)", Icon = "rbxassetid://7743871480" })
local AutoPlayTab = Window:AddTab({ Title = "Auto Play", Icon = "rbxassetid://7734053495" })
local SettingsTab = Window:AddTab({ Title = "Settings", Icon = "rbxassetid://6031280882" })

-- Dukungan Logo saat minimize
task.spawn(function()
    repeat task.wait(0.25) until game:IsLoaded()
    getgenv().Image = "rbxassetid://120727887371733"
    getgenv().ToggleUI = Enum.KeyCode.LeftControl -- Pastikan ini konsisten

    if not getgenv().LoadedMobileUI then
        getgenv().LoadedMobileUI = true
        local OpenUI = Instance.new("ScreenGui")
        local ImageButton = Instance.new("ImageButton")
        local UICorner = Instance.new("UICorner")

        if syn and syn.protect_gui then syn.protect_gui(OpenUI) end
        OpenUI.Parent = syn and syn.protect_gui and game:GetService("CoreGui") or gethui and gethui() or game:GetService("CoreGui")
        
        OpenUI.Name = "OpenUI"
        OpenUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

        ImageButton.Parent = OpenUI
        ImageButton.BackgroundColor3 = Color3.fromRGB(105, 105, 105)
        ImageButton.BackgroundTransparency = 0.8
        ImageButton.Position = UDim2.new(0.9, 0, 0.1, 0)
        ImageButton.Size = UDim2.new(0, 50, 0, 50)
        ImageButton.Image = getgenv().Image
        ImageButton.Draggable = true
        ImageButton.Transparency = 0.2
        UICorner.CornerRadius = UDim.new(0, 200)
        UICorner.Parent = ImageButton

        ImageButton.MouseButton1Click:Connect(function()
            VirtualInputManager:SendKeyEvent(true, getgenv().ToggleUI, false, game)
            task.wait()
            VirtualInputManager:SendKeyEvent(false, getgenv().ToggleUI, false, game)
        end)
    end
end)

-- Pilih tab Info secara otomatis saat startup
Window:SelectTab(1)

-- Konten Tab Info
local InfoSection = InfoTab:AddSection("Informasi")
InfoSection:AddParagraph({ Title = "Anime Saga Script", Content = "Versi Gabungan: 1.0\nStatus: Aktif" })
InfoSection:AddParagraph({ Title = "Pengembang Asli", Content = "Duong Tuan & ghjiukliop (dan kontributor Fluent)" })
InfoSection:AddParagraph({ Title = "Penggabung", Content = "AI Assistant" })


-- Konten Tab Play (Story - dari Skrip 2)
local StorySection = PlayTab:AddSection("Story Mode")
local selectedMap = ConfigSystem.CurrentConfig.SelectedMap
local selectedAct = ConfigSystem.CurrentConfig.SelectedAct
local selectedDifficulty = ConfigSystem.CurrentConfig.SelectedDifficulty
local autoJoinStoryEnabled = ConfigSystem.CurrentConfig.AutoJoinStory

local mapNames = {"Leaf Village", "Marine Island", "Red Light District", "West City"}
local difficultyNames = {"Normal", "Hard", "Nightmare"}
local actValues = {"1", "2", "3", "4", "5"}

local function joinStory()
    if not ReplicatedStorage or not ReplicatedStorage:FindFirstChild("Event") or not ReplicatedStorage.Event:FindFirstChild("JoinRoom") then
        warn("Event JoinRoom tidak ditemukan di ReplicatedStorage.Event")
        return false
    end
    local success, err = pcall(function()
        local args1 = { "Create", "Story", selectedMap, selectedAct, selectedDifficulty, false }
        ReplicatedStorage.Event.JoinRoom:FireServer(unpack(args1))
        task.wait(1)
        local args2 = { "TeleGameplay", "Story", selectedMap, selectedAct, selectedDifficulty, false }
        ReplicatedStorage.Event.JoinRoom:FireServer(unpack(args2))
        print("Telah bergabung dengan Story: " .. mapNames[selectedMap] .. " - Act " .. selectedAct .. " - " .. difficultyNames[selectedDifficulty])
    end)
    if not success then
        warn("Kesalahan saat bergabung dengan Story: " .. tostring(err))
        return false
    end
    return true
end

-- PLACEHOLDER: Anda perlu mengimplementasikan ini berdasarkan game Anda
local function isPlayerInMap()
    -- Contoh: return workspace:FindFirstChild("CurrentMapName") and workspace.CurrentMapName.Value == mapNames[selectedMap]
    return false -- Ganti dengan logika sebenarnya
end

StorySection:AddDropdown("MapDropdown", {
    Title = "Pilih Map", Values = mapNames, Multi = false, Default = selectedMap,
    Callback = function(Value)
        for i, name in ipairs(mapNames) do if name == Value then selectedMap = i break end end
        ConfigSystem.CurrentConfig.SelectedMap = selectedMap
        ConfigSystem.SaveConfig()
        print("Map dipilih: " .. Value .. " (index: " .. selectedMap .. ")")
    end
})
StorySection:AddDropdown("ActDropdown", {
    Title = "Pilih Act", Values = actValues, Multi = false, Default = tostring(selectedAct),
    Callback = function(Value)
        selectedAct = tonumber(Value)
        ConfigSystem.CurrentConfig.SelectedAct = selectedAct
        ConfigSystem.SaveConfig()
        print("Act dipilih: " .. Value)
    end
})
StorySection:AddDropdown("DifficultyDropdown", {
    Title = "Kesulitan", Values = difficultyNames, Multi = false, Default = difficultyNames[selectedDifficulty],
    Callback = function(Value)
        for i, name in ipairs(difficultyNames) do if name == Value then selectedDifficulty = i break end end
        ConfigSystem.CurrentConfig.SelectedDifficulty = selectedDifficulty
        ConfigSystem.SaveConfig()
        print("Kesulitan dipilih: " .. Value .. " (index: " .. selectedDifficulty .. ")")
    end
})

local autoJoinStoryThread
StorySection:AddToggle("AutoJoinStoryToggle", {
    Title = "Auto Join Story", Default = autoJoinStoryEnabled,
    Callback = function(Value)
        autoJoinStoryEnabled = Value
        ConfigSystem.CurrentConfig.AutoJoinStory = Value
        ConfigSystem.SaveConfig()
        if autoJoinStoryEnabled then
            print("Auto Join Story telah diaktifkan")
            if autoJoinStoryThread then task.cancel(autoJoinStoryThread) end
            autoJoinStoryThread = task.spawn(function()
                while autoJoinStoryEnabled and task.wait(5) do
                    if not isPlayerInMap() then
                        print("Mencoba auto join story...")
                        joinStory()
                    else
                        print("Sudah di dalam map, menunggu keluar...")
                    end
                end
            end)
            -- Coba join sekali saat diaktifkan jika tidak di map
            if not isPlayerInMap() then joinStory() end
        else
            print("Auto Join Story telah dinonaktifkan")
            if autoJoinStoryThread then task.cancel(autoJoinStoryThread); autoJoinStoryThread = nil end
        end
    end
})
StorySection:AddButton({ Title = "Join Story Sekarang", Callback = joinStory })

-- Konten Tab Auto Play (dari Skrip 1)
local AutoPlaySectionContent = AutoPlayTab:AddSection("Fitur Auto Play")

local function findNearestEnemy()
    if not humanoidRootPart then return nil end
    local mobsFolder = workspace:FindFirstChild("Enemy")
    if not mobsFolder then return nil end
    local mobsGroup = mobsFolder:FindFirstChild("Mob")
    if not mobsGroup then return nil end

    local nearestMob, nearestDistance = nil, math.huge
    for _, mob in ipairs(mobsGroup:GetChildren()) do
        if mob:IsA("Model") and mob:FindFirstChild("HumanoidRootPart") and mob:FindFirstChild("Humanoid") and mob.Humanoid.Health > 0 then
            local mobHRP = mob.HumanoidRootPart
            local dist = (mobHRP.Position - humanoidRootPart.Position).Magnitude
            if dist < nearestDistance then
                nearestDistance = dist
                nearestMob = mob
            end
        end
    end
    return nearestMob
end

local function getPositionData()
    if humanoidRootPart then
        return humanoidRootPart.CFrame, humanoidRootPart.Position
    end
    return nil, nil
end

-- Auto Play Toggle Utama
AutoPlaySectionContent:AddToggle("AutoPlayToggle", {
    Title = "Aktifkan Auto Play (Global)", Default = ConfigSystem.CurrentConfig.AutoPlayEnabled,
    Callback = function(Value)
        ConfigSystem.CurrentConfig.AutoPlayEnabled = Value
        ConfigSystem.SaveConfig()
        if Value then print("Auto Play Global diaktifkan!") else print("Auto Play Global dinonaktifkan!") end
    end
})

-- Auto TP Enemy
local followConnection
AutoPlaySectionContent:AddToggle("AutoFollowEnemy", {
    Title = "Auto TP ke Musuh", Default = ConfigSystem.CurrentConfig.AutoFollowEnemy,
    Callback = function(Value)
        ConfigSystem.CurrentConfig.AutoFollowEnemy = Value
        ConfigSystem.SaveConfig()
        if Value then
            if followConnection then followConnection:Disconnect() end
            followConnection = RunService.Heartbeat:Connect(function()
                if ConfigSystem.CurrentConfig.AutoPlayEnabled and ConfigSystem.CurrentConfig.AutoFollowEnemy and character and humanoidRootPart then
                    local nearestEnemy = findNearestEnemy()
                    if nearestEnemy and nearestEnemy:FindFirstChild("HumanoidRootPart") then
                        local enemyHRP = nearestEnemy.HumanoidRootPart
                        local targetPos = enemyHRP.Position - Vector3.new(0, 2, 0) -- Posisi sedikit di atas tanah musuh
                        local lookPos = enemyHRP.Position
                        character:PivotTo(CFrame.new(targetPos, lookPos))
                    end
                end
            end)
            print("Auto TP ke Musuh diaktifkan.")
        else
            if followConnection then followConnection:Disconnect(); followConnection = nil end
            print("Auto TP ke Musuh dinonaktifkan.")
        end
    end
})

-- Auto Combat
local combatThread
AutoPlaySectionContent:AddToggle("AutoCombat", {
    Title = "Auto Combat", Default = ConfigSystem.CurrentConfig.AutoCombat,
    Callback = function(Value)
        ConfigSystem.CurrentConfig.AutoCombat = Value
        ConfigSystem.SaveConfig()
        if Value then
            if combatThread then task.cancel(combatThread) end
            combatThread = task.spawn(function()
                while ConfigSystem.CurrentConfig.AutoPlayEnabled and ConfigSystem.CurrentConfig.AutoCombat and task.wait(0.2) do
                    local combatFunction = nil
                    -- Metode pencarian fungsi 'Combat' ini mungkin perlu disesuaikan
                    for _, func in ipairs(getgc(true)) do
                        if typeof(func) == "function" then
                            local info = debug.getinfo(func)
                            if info.name == "Combat" and info.nups > 0 then -- Contoh filter tambahan
                                local consts = debug.getconstants(func)
                                if table.find(consts, "Humanoid") and table.find(consts, "Slash") then
                                    combatFunction = func
                                    break
                                end
                            end
                        end
                    end
                    if combatFunction then pcall(combatFunction) else -- warn("Fungsi Combat tidak ditemukan")
                    end
                end
            end)
            print("Auto Combat diaktifkan.")
        else
            if combatThread then task.cancel(combatThread); combatThread = nil end
            print("Auto Combat dinonaktifkan.")
        end
    end
})
AutoPlaySectionContent:AddParagraph({ Title = "Auto Skills", Content = "Gunakan skill secara otomatis." })

-- Auto Skills (1-3)
local skillThreads = {}
local skillCooldowns = {Skill1 = 5, Skill2 = 7, Skill3 = 10} -- Cooldown dalam detik

for i = 1, 3 do
    local skillName = "AutoSkill" .. i
    local skillKey = "Skill" .. i -- Untuk event
    AutoPlaySectionContent:AddToggle(skillName, {
        Title = "Auto " .. skillKey, Default = ConfigSystem.CurrentConfig[skillName],
        Callback = function(Value)
            ConfigSystem.CurrentConfig[skillName] = Value
            ConfigSystem.SaveConfig()
            if Value then
                if skillThreads[skillKey] then task.cancel(skillThreads[skillKey]) end
                skillThreads[skillKey] = task.spawn(function()
                    while ConfigSystem.CurrentConfig.AutoPlayEnabled and ConfigSystem.CurrentConfig[skillName] and task.wait(skillCooldowns[skillKey]) do
                        if not ReplicatedStorage or not ReplicatedStorage:FindFirstChild("Events") or not ReplicatedStorage.Events:FindFirstChild("Skill") then
                            warn("Event Skill tidak ditemukan di ReplicatedStorage.Events")
                            break -- Hentikan loop jika event tidak ada
                        end
                        local cf, pos = getPositionData()
                        if cf and pos then
                            local args = {skillKey, cf, pos, "OnSkill"}
                            ReplicatedStorage.Events.Skill:FireServer(unpack(args))
                            print("Menggunakan " .. skillKey)
                        end
                    end
                end)
                print(skillName .. " diaktifkan.")
            else
                if skillThreads[skillKey] then task.cancel(skillThreads[skillKey]); skillThreads[skillKey] = nil end
                print(skillName .. " dinonaktifkan.")
            end
        end
    })
end
AutoPlaySectionContent:AddParagraph({ Title = "Petunjuk Auto Play", Content = "Aktifkan 'Auto Play Global' lalu pilih fitur spesifik yang ingin dijalankan." })

-- Konten Tab Settings
local SettingsSectionMain = SettingsTab:AddSection("Pengaturan Utama")
SettingsSectionMain:AddDropdown("ThemeDropdown", {
    Title = "Pilih Tema", Values = {"Dark", "Light", "Darker", "Aqua", "Amethyst"}, Multi = false, Default = ConfigSystem.CurrentConfig.UITheme,
    Callback = function(Value)
        Window.Theme = Value -- Langsung ubah tema window
        Fluent.Theme = Value -- Ubah juga tema global Fluent jika perlu
        ConfigSystem.CurrentConfig.UITheme = Value
        ConfigSystem.SaveConfig()
        print("Tema dipilih: " .. Value)
    end
})

local RedeemSection = SettingsTab:AddSection("Redeem Kode")
RedeemSection:AddButton({
    Title = "Redeem Semua Kode (Default)",
    Callback = function()
        local codes = {"Release", "SorryForDelay", "SorryForShutdown", "50KActive", "1MVisits", "InBugSagaWeTrust"}
        task.spawn(function()
            for _, code in ipairs(codes) do
                if not ReplicatedStorage or not ReplicatedStorage:FindFirstChild("Event") or not ReplicatedStorage.Event:FindFirstChild("Codes") then
                    warn("Event Codes tidak ditemukan di ReplicatedStorage.Event")
                    break
                end
                local s, e = pcall(function() ReplicatedStorage.Event.Codes:FireServer(code) end)
                if s then print("Mencoba redeem kode: " .. code) else warn("Kesalahan saat redeem kode " .. code .. ": " .. tostring(e)) end
                task.wait(0.6) -- jeda sedikit lebih lama
            end
            print("Selesai mencoba redeem semua kode default!")
        end)
    end
})

local customCodeInput
customCodeInput = RedeemSection:AddInput("CustomCodeInput", {
    Title = "Kode Kustom", Placeholder = "Masukkan kode di sini", Numeric = false, Finished = true,
    Callback = function(Value)
        if Value and Value ~= "" then
            if not ReplicatedStorage or not ReplicatedStorage:FindFirstChild("Event") or not ReplicatedStorage.Event:FindFirstChild("Codes") then
                warn("Event Codes tidak ditemukan di ReplicatedStorage.Event")
                return
            end
            local s, e = pcall(function() ReplicatedStorage.Event.Codes:FireServer(Value) end)
            if s then print("Mencoba redeem kode kustom: " .. Value) else warn("Kesalahan saat redeem kode " .. Value .. ": " .. tostring(e)) end
            if customCodeInput and customCodeInput.SetText then customCodeInput:SetText("") end -- Gunakan SetText jika tersedia
        end
    end
})

SettingsTab:AddParagraph({ Title = "Konfigurasi Otomatis", Content = "Konfigurasi Anda disimpan secara otomatis dengan nama karakter: " .. playerName })
SettingsTab:AddParagraph({ Title = "Tombol Pintas", Content = "Tekan LeftControl untuk menyembunyikan/menampilkan antarmuka" })

-- Integrasi dengan SaveManager dan InterfaceManager
if SaveManager and InterfaceManager then
    SaveManager:SetLibrary(Fluent)
    InterfaceManager:SetLibrary(Fluent)
    InterfaceManager:SetFolder("HTHubAS_Combined") -- Folder baru untuk menghindari konflik
    SaveManager:SetFolder("HTHubAS_Combined/" .. playerName)
else
    warn("SaveManager atau InterfaceManager tidak berhasil dimuat.")
end

-- Auto Save Config (fungsi sudah ada, hanya memastikan event listener diatur)
local function setupSaveEventsForAllTabs()
    -- Fungsi ini dipanggil setelah semua tab dan elemen UI dibuat.
    -- Fluent menangani penyimpanan nilai elemennya sendiri jika `SaveManager` dikonfigurasi.
    -- `ConfigSystem.SaveConfig()` dipanggil oleh callback elemen spesifik jika perlu.
    -- Namun, jika ada elemen Fluent yang tidak secara otomatis menyimpan melalui SaveManager
    -- dan Anda ingin perubahan mereka memicu ConfigSystem.SaveConfig(), tambahkan di sini.
    -- Contoh:
    -- for _, tab in pairs({InfoTab, PlayTab, AutoPlayTab, SettingsTab}) do
    --     if tab and tab._components then
    --         for _, element in pairs(tab._components) do
    --             if element and element.OnChanged and not element.Save then -- Hanya jika tidak disimpan oleh SaveManager
    --                 element.OnChanged:Connect(function()
    --                     -- Anda mungkin perlu mengambil nilai elemen dan menyimpannya ke ConfigSystem.CurrentConfig di sini
    --                     -- ConfigSystem.CurrentConfig.SomeValue = element:GetValue()
    --                     ConfigSystem.SaveConfig()
    --                 end)
    --             end
    --         end
    --     end
    -- end
    print("Event listener untuk penyimpanan telah diatur (jika diperlukan).")
end
setupSaveEventsForAllTabs() -- Panggil setelah semua UI dibuat

print("HT Hub | Anime Saga (Combined Script) telah berhasil dimuat!")

-- Inisialisasi status toggle dari config setelah UI dibuat
if Window and Window.IsLoaded then -- Pastikan window sudah siap
    -- Inisialisasi AutoFollowEnemy
    local autoFollowToggle = AutoPlaySectionContent:GetComponent("AutoFollowEnemy")
    if autoFollowToggle and ConfigSystem.CurrentConfig.AutoFollowEnemy then
        autoFollowToggle:SetValue(true) -- Picu callback untuk memulai koneksi jika true
    end
    -- Inisialisasi AutoCombat
    local autoCombatToggle = AutoPlaySectionContent:GetComponent("AutoCombat")
    if autoCombatToggle and ConfigSystem.CurrentConfig.AutoCombat then
        autoCombatToggle:SetValue(true)
    end
    -- Inisialisasi AutoSkills
    for i = 1, 3 do
        local skillName = "AutoSkill" .. i
        local skillToggle = AutoPlaySectionContent:GetComponent(skillName)
        if skillToggle and ConfigSystem.CurrentConfig[skillName] then
            skillToggle:SetValue(true)
        end
    end
    -- Inisialisasi AutoJoinStory
    local autoJoinStoryToggle = StorySection:GetComponent("AutoJoinStoryToggle")
    if autoJoinStoryToggle and ConfigSystem.CurrentConfig.AutoJoinStory then
        autoJoinStoryToggle:SetValue(true)
    end
else
    warn("Window Fluent belum sepenuhnya dimuat untuk inisialisasi toggle.")
end

Features & Information

Auto Dungeon + Auto Attack

Community Comments (0)

No comments yet for this script.

More Scripts for [🔥NEW!] Anime Saga