local Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()

-- Configurations
local Config = {
    Name = "Rodan Hub|@RodanHub = Youtube",
    Icon = 110387052435330,
    LoadingTitle = "Rodan Hub",
    LoadingSubtitle = "by @RodanHubonYT",
    Theme = "Default",
    DisableRayfieldPrompts = false,
    DisableBuildWarnings = false,
    ConfigFolder = "RodanHub",
    DiscordInvite = "PfazPQfc",
    KeySettings = {
        Title = "Rodan Hub",
        Subtitle = "Key System",
        Note = "Get Key By Joining Discord | YT=@RodanHubonYT",
        FileName = "RodanHubKey_" .. game.Players.LocalPlayer.Name,
        SaveKey = true,
        GrabKeyFromSite = true, -- Uses a remote server for the key
        KeyURL = "https://[Log in to view URL]", -- URL to fetch new keys
        ExpireDays = 3 -- Keys expire every 3 days
    }
}

-- Helper function to fetch a key
local function fetchKey()
    local success, key = pcall(function()
        return game:HttpGet(Config.KeySettings.KeyURL)
    end)
    if success and key then
        return key
    else
        warn("Failed to fetch key: " .. tostring(key))
        return nil
    end
end

-- Helper function to save the key locally
local function saveKey(key)
    writefile(Config.KeySettings.FileName, key)
end

-- Helper function to load and check the key
local function loadKey()
    if isfile(Config.KeySettings.FileName) then
        local keyData = readfile(Config.KeySettings.FileName)
        local key, timestamp = unpack(string.split(keyData, "|"))
        if os.time() - tonumber(timestamp) < Config.KeySettings.ExpireDays * 86400 then
            return key
        else
            return nil -- Key expired
        end
    else
        return nil -- Key not found
    end
end

-- Load the key or fetch a new one if expired
local currentKey = loadKey()
if not currentKey then
    local newKey = fetchKey()
    if newKey then
        saveKey(newKey .. "|" .. os.time())
        currentKey = newKey
    else
        error("Failed to retrieve a valid key.")
    end
end

-- Create Window
local Window = Rayfield:CreateWindow({
    Name = Config.Name,
    Icon = Config.Icon,
    LoadingTitle = Config.LoadingTitle,
    LoadingSubtitle = Config.LoadingSubtitle,
    Theme = Config.Theme,
    DisableRayfieldPrompts = Config.DisableRayfieldPrompts,
    DisableBuildWarnings = Config.DisableBuildWarnings,
    ConfigurationSaving = {
        Enabled = true,
        FolderName = Config.ConfigFolder,
        FileName = Config.KeySettings.FileName
    },
    Discord = {
        Enabled = true,
        Invite = Config.DiscordInvite,
        RememberJoins = true
    },
    KeySystem = true,
    KeySettings = Config.KeySettings
})

local Window = Rayfield:CreateWindow({
    Name = Config.Name,
    Icon = Config.Icon,
    LoadingTitle = Config.LoadingTitle,
    LoadingSubtitle = Config.LoadingSubtitle,
    Theme = Config.Theme,
    DisableRayfieldPrompts = Config.DisableRayfieldPrompts,
    DisableBuildWarnings = Config.DisableBuildWarnings,
    ConfigurationSaving = {
        Enabled = true,
        FolderName = Config.ConfigFolder,
        FileName = Config.KeySettings.FileName
    },
    Discord = {
        Enabled = true,
        Invite = Config.DiscordInvite,
        RememberJoins = true
    },
    KeySystem = true,
    KeySettings = Config.KeySettings
})

---

### **Tab Management Enhancements**
Define tabs and reusable callbacks dynamically to reduce redundancy:

```lua
-- Tab Definitions
local Tabs = {
    Farm = Window:CreateTab("Farm", 78832038241257),
    Bounty = Window:CreateTab("Bounty", 127881003227995),
    FruitBG = Window:CreateTab("Fruit BG", 75854525981299),
    Fisch = Window:CreateTab("Fisch", 110654365030834),
    Misc = Window:CreateTab("Misc", 108129201671893)
}


-- Button Generator
local function createScriptButton(tab, name, url)
    tab:CreateButton({
        Name = name,
        Callback = function()
            local success, err = pcall(function()
                local script = game:HttpGet(url)
                loadstring(script)()
            end)
            if not success then
                warn("Failed to load " .. name .. ": " .. tostring(err))
            end
        end
    })
end

-- Add Buttons to Tabs
createScriptButton(Tabs.Farm, "Redz Hub", "https://[Log in to view URL]")
createScriptButton(Tabs.Farm, "HoHo Hub", "https://[Log in to view URL]")
createScriptButton(Tabs.Bounty, "Sera Hub", "https://[Log in to view URL]")
createScriptButton(Tabs.FruitBG, "Askien Hub", "https://[Log in to view URL]")
createScriptButton(Tabs.Fisch, "Speed hub X", "https://[Log in to view URL]")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: