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 Completing Linkvertise",
        FileName = "RodanHubKey_" .. game.Players.LocalPlayer.Name,
        SaveKey = true,
        GrabKeyFromSite = true, -- Set to true if using Linkvertise
        KeyURL = "https://[Log in to view URL]", -- Your Linkvertise URL here
        ExpireDays = 3 -- Keys expire after 3 days
    }
}

-- Helper function to split a string by delimiter
local function split(str, delimiter)
    local result = {}
    for match in (str..delimiter):gmatch("(.-)"..delimiter) do
        table.insert(result, match)
    end
    return result
end

-- Helper function to fetch the key from the Linkvertise URL
local function fetchKeyFromLinkvertise()
    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 from Linkvertise: " .. 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 parts = split(keyData, "|")
        local key = parts[1]
        local timestamp = tonumber(parts[2])
        if os.time() - timestamp < Config.KeySettings.ExpireDays * 86400 then
            return key
        else
            return nil -- Key expired
        end
    else
        return nil -- Key not found
    end
end

-- Helper function to delete the key after expiration
local function deleteKey()
    if isfile(Config.KeySettings.FileName) then
        delfile(Config.KeySettings.FileName)
        print("Key deleted due to expiration.")
    end
end

-- Load the key or fetch a new one if expired
local currentKey = loadKey()

if not currentKey then
    local newKey = fetchKeyFromLinkvertise()
    if newKey then
        saveKey(newKey .. "|" .. os.time()) -- Save the new key with timestamp
        currentKey = newKey
    else
        error("Failed to retrieve a valid key from Linkvertise.")
    end
else
    -- If the key is expired, delete it and fetch a new one
    local parts = split(readfile(Config.KeySettings.FileName), "|")
    local timestamp = tonumber(parts[2])

    if os.time() - timestamp >= Config.KeySettings.ExpireDays * 86400 then
        deleteKey()
        local newKey = fetchKeyFromLinkvertise()
        if newKey then
            saveKey(newKey .. "|" .. os.time()) -- Save the new key with timestamp
            currentKey = newKey
        else
            error("Failed to retrieve a valid key from Linkvertise.")
        end
    end
end

-- Create the Window and Key System
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,
    Key = currentKey  -- Provide the current key to the KeySystem
})

-- Add any other custom functionality to the window here
-- You can use Platoboost's system to add buttons, labels, and more.

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))
            else
                print(name .. " script loaded successfully.")
            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: