Tổng Key
0
🔑
Active
0
Hết hạn
0
VIP
0
👑
Key Gần Đây
KEYUSER IDLOẠIHẾT HẠNTRẠNG THÁI
Tất cả
Active
Hết hạn
VIP
0 key được chọn
Danh sách Key
🔍
KEYUSER IDLOẠINGÀY TẠOHẾT HẠNTRẠNG THÁITHAO TÁC
⚡ Tạo Key Nhanh
VND_
Chỉ dùng chữ, số, dấu gạch dưới. Nếu nhập tên sẽ tạo đúng 1 key dù số lượng > 1.
📋 Key Vừa Tạo
🔑
Chưa có key nào
📦 Tạo Hàng Loạt
VND_
Key tạo ra chưa gắn User ID. Khi người dùng nhập key lần đầu, hệ thống tự động gắn ID của họ vào key đó.
📋
Đang tải...
🎮 Code Roblox Script
Dán đoạn này vào LocalScript Roblox để check key qua Firebase:
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

local DB = "https://vndhubkey-default-rtdb.asia-southeast1.firebasedatabase.app"
-- Thay bằng Web API Key của Firebase project của bạn
local FIREBASE_API_KEY = "AIzaSyDusTbC_dGonpAigC8yhH3Dr4NjjV5_7wk"

CheckButton.MouseButton1Click:Connect(function()
    local input = TextBox.Text:match("^%s*(.-)%s*$") -- trim whitespace
    local userId = tostring(LocalPlayer.UserId)
    local keyId = input:gsub("[^%w_]", "_")

    -- 1. Đọc key từ Firebase
    local url = DB .. "/keys/" .. keyId .. ".json"
    local ok, res = pcall(function() return game:HttpGet(url) end)
    if not ok then StatusLabel.Text = "❌ Lỗi kết nối!"; return end

    local data = HttpService:JSONDecode(res)
    if data == nil then
        StatusLabel.Text = "❌ Key không tồn tại!"
        return
    end

    -- 2. Kiểm tra key đã bị gắn cho người khác chưa
    if data.userId ~= nil and data.userId ~= "" and data.userId ~= userId then
        StatusLabel.Text = "❌ Key này đã thuộc về người khác!"
        return
    end

    -- 3. Kiểm tra hết hạn
    if data.type ~= "vip" and data.expire < os.date("%Y-%m-%d") then
        StatusLabel.Text = "❌ Key đã hết hạn!"
        return
    end

    -- 4. Nếu key chưa có userId → tự động gắn userId của người dùng này
    if data.userId == nil or data.userId == "" then
        local patchUrl = DB .. "/keys/" .. keyId .. ".json?auth=" .. FIREBASE_API_KEY
        local body = HttpService:JSONEncode({ userId = userId })
        local pok, _ = pcall(function()
            HttpService:RequestAsync({
                Url = patchUrl,
                Method = "PATCH",
                Headers = { ["Content-Type"] = "application/json" },
                Body = body
            })
        end)
        if not pok then
            StatusLabel.Text = "⚠️ Không thể gắn key, thử lại!"
            return
        end
    end

    -- 5. Xác thực thành công
    StatusLabel.Text = "✅ Xác thực thành công!"
    task.wait(1)
    ScreenGui:Destroy()
    keyOk = true
end)
🔥 Firebase Rules
Dán vào Firebase Rules để bảo mật:
{
  "rules": {
    "keys": {
      ".read": true,
      ".write": false,
      "$keyId": {
        ".read": true,
        "userId": {
          ".write": "data.val() === '' || data.val() === null"
        }
      }
    },
    "logs": {
      ".read": false,
      ".write": false
    }
  }
}
🗄️ Dữ liệu