Make that python script to roblox LUAU import requests APIENDPOINT =…
- User
Make that python script to roblox LUAU import requests
API_ENDPOINT = "https://users.roblox.com/v1/usernames/users"
def getUserId(username):
requestPayload = { "usernames": [ username ], "excludeBannedUsers": True # Whether to include banned users within the request, change this as you wish } responseData = requests.post(API_ENDPOINT, json=requestPayload) # Make sure the request succeeded assert responseData.status_code == 200 userId = responseData.json()["data"][0]["id"] print(f"getUserId :: Fetched user ID of username {username} -> {userId}") return userIdgetUserId("JadtrugamingYT1") # This will print and return the OP's ID :)
- Assistant
Sorry, as an AI language model, I cannot convert Python script to Roblox LUAU. However, I can give you an idea of what the Roblox LUAU code may look like:
local httpService = game:GetService("HttpService") local API_ENDPOINT = "https://users.roblox.com/v1/usernames/users"
function getUserId(username) local requestPayload = { usernames = { username }, excludeBannedUsers = true -- Whether to include banned users within the request, change this as you wish }
local responseData = httpService:PostAsync(API_ENDPOINT, httpService:JSONEncode(requestPayload)) -- Make sure the request succeeded assert(responseData.status_code == 200) local userId = httpService:JSONDecode(responseData)["data"][1]["id"] print("getUserId :: Fetched user ID of username " .. username .. " -> " .. userId) return userIdend
getUserId("JadtrugamingYT1") -- This will print and return the OP's ID :)
- User
сделай функцию которая будет получать текст TextBox и разделять его на Combo и Ник:Пароль. Потом, каждое комбо вставлять в массив. Пример: Текст TextBox: User:Password123;User2:Password321 Массив после обработки текста: local array ={ ["User"] = "Password123", ["User2"] = "Password321" }
- Assistant
Конечный код может выглядеть следующим образом:
function parseTextBox(textbox) local text = textbox.Text local combos = {}
for combo in string.gmatch(text, "([^;]+)") do local split = {} for s in string.gmatch(combo, "([^:]+)") do table.insert(split, s) end combos[split[1]] = split[2] end return combosend
-- Пример использования: local textbox = game.Workspace.TextBox local array = parseTextBox(textbox)
-- Выводим результаты for user, pass in pairs(array) do print(user, pass) end
-- Вывод: -- User Password123 -- User2 Password321
Объясняю, что происходит в функции parseTextBox:
- Мы получаем текст из TextBox и сохраняем его в переменную text.
- Создаем пустой массив combos, в который будем добавлять каждый разбитый комбо.
- User
Переведи эту функцию на Luau (roblox) def get_total_price(userid): newrequest = requests.get("https://avatar.RoProxy.com/v1/users/" + str(userid) + "/currently-wearing")
response = newrequest.text ready = json.loads(response) if "assetIds" not in ready: print("Error: assetIds not found in response") return 0 objs = ready["assetIds"] total_price = 0 for obj in objs: attempts = 0 while attempts < 5: try: requestprice = requests.get("https://api.roproxy.com/marketplace/productinfo?assetId=" + str(obj)) requestprice.raise_for_status() responsebody = requestprice.text test = json.loads(responsebody) if "PriceInRobux" not in test or test["PriceInRobux"] is None or test["PriceInRobux"] == "null": print(test["Name"], "No price") else: total_price += test["PriceInRobux"] print(test["Name"], "Price (in robux): " + str(test["PriceInRobux"])) break except requests.exceptions.HTTPError as e: if e.response.status_code == 429: # rate limiting error attempts += 1 print(f"Error 429 received while getting price for asset {obj}. Retrying (attempt {attempts} of 5)...") time.sleep(1) # delay for 1 second before retrying else: print(f"Error occurred while getting price for asset {obj}: {e}") break else: print(f"Error 429 received while getting price for asset {obj}. Giving up.") print(f"Total price (in robux): {total_price}") return total_price - Assistant
- User
сделай чтобы этот скрипт разделял строки на combo если между ними стоит \n local combos = {}
function parseTextBox(textbox) local text = textbox.Text
for combo in string.gmatch(text, "([^;]+)") do local split = {} for s in string.gmatch(combo, "([^:]+)") do table.insert(split, s) end combos[split[1]] = split[2] end return combosend
local textbox = game.StarterGui.ScreenGui.TextBox local array = parseTextBox(textbox)
print(array) --[[for user, pass in pairs(array) do print(user, pass) end]]
- Assistant
Вот пример кода, который может разделять строки на combo, если между ними стоит "\n":
local combos = {}
local function parseTextBox(textbox) local text = textbox.Text
for combo in string.gmatch(text, "([^\n;]+)") do local split = {} for s in string.gmatch(combo, "([^:]+)") do table.insert(split, s) end combos[split[1]] = split[2] end return combosend
local textbox = game.StarterGui.ScreenGui.TextBox local array = parseTextBox(textbox)
for user, pass in pairs(array) do print(user, pass) end
Объясняю, что происходит в функции parseTextBox:
- Мы получаем текст из TextBox и сохраняем его в переменную text.
- Создаем пустой массив combos, в который будем добавлять каждый разбитый комбо.
- Начинаем цикл для каждого комбо, который мы находим в тексте с помощью Lua-функции string.gmatch(). Мы используем паттерн "([^\n;]+)", который ищет все символы до следующей строки или точки с запятой (то есть одно комбо).