Skip to content

Instantly share code, notes, and snippets.

@Apearson75
Last active April 14, 2023 16:37
Show Gist options
  • Save Apearson75/574ba69de247d2e749e0c7e13076c8ff to your computer and use it in GitHub Desktop.
Save Apearson75/574ba69de247d2e749e0c7e13076c8ff to your computer and use it in GitHub Desktop.
Roblox Limited Sniper
/* ***************************************** */
/* Roblox Limited Sniper */
/* By Apearson */
/* https://github.com/Phoneguytech75 */
/* ***************************************** */
// alert("Made By Apearson");
// alert("Check Console for information");
// Trick to run forever on mobile.
const audio = new Audio("https://cdn.discordapp.com/attachments/853331978538844210/1096471895488081960/silence.mp3");
audio.loop = true;
audio.play();
let id = null;
let creatorID = null;
let cool_id = null;
let p_id = null;
let amNow = false;
let sleepTime = 1750;
let amount = 0;
const searchURL = 'https://catalog.roblox.com/v1/search/items?category=All&limit=120&maxPrice=0&salesTypeFilter=2&SortType=3';
const sleep = ms => new Promise(r => setTimeout(r, ms));
async function purchase() {
const req = await fetch(`https://apis.roblox.com/marketplace-sales/v1/item/${cool_id}/purchase-item`, {
method: 'POST',
credentials: 'include',
headers: {
'x-csrf-token': Roblox.XsrfToken.getToken(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
collectibleItemId: cool_id,
collectibleProductId: p_id,
expectedCurrency: 1,
expectedPrice: 0,
expectedPurchaserId: Roblox.CurrentUser.userId,
expectedPurchaserType: 'User',
expectedSellerId: creatorID,
expectedSellerType: 'User',
idempotencyKey: CoreUtilities.uuidService.generateRandomUuid()
})
});
if (req.status === 200) {
const json = await req.json();
if (json.purchased) {
amount++;
console.log(`Purchased: ${amount}`);
} else {
if (json.errorMessage === 'QuantityExhausted') {
amNow = false;
sleepTime = 1750;
console.log("Stock is Gone");
} else
console.log("Error On Purchase");
}
} else {
console.log("Error On Request");
}
}
async function check() {
const r = await fetch(searchURL, {
headers: {
'x-csrf-token': Roblox.XsrfToken.getToken()
},
credentials: 'include'
});
if (r.status === 200) {
const j = await r.json();
if (j.data.length > 0) {
id = j.data[0].id;
const req = await fetch(`https://catalog.roblox.com/v1/catalog/items/${id}/details?itemType=Asset`, {
headers: {
'x-csrf-token': Roblox.XsrfToken.getToken(),
},
credentials: 'include',
});
if (req.status === 200) {
const json = await req.json();
if (json['priceStatus'])
return {status: false}
else {
creatorID = json.creatorTargetId;
const req2 = await fetch('https://apis.roblox.com/marketplace-items/v1/items/details', {
method: 'POST',
headers: {
'x-csrf-token': Roblox.XsrfToken.getToken(),
'Content-Type': 'application/json'
},
credentials: 'include',
body: JSON.stringify({
itemIds: [json['collectibleItemId']]
})
});
const json2 = await req2.json();
return {status: true, ID: json['collectibleItemId'], p_ID: json2[0]['collectibleProductId']}
}
}
else {
console.log(`Uh oh: ${req.status}`);
return {status: false};
}
} else {
return {status: false};
}
} else {
await sleep(5000);
return {status: false};
}
}
while (true) {
if (!amNow) {
const status = await check();
if (status.status) {
amNow = true;
sleepTime = 500;
cool_id = status.ID;
p_id = status.p_ID;
}
else
console.log("Not Yet");
}
if (amNow)
await purchase();
await sleep(sleepTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment