local player = game:GetService("Players").LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local events = replicatedStorage:WaitForChild("Events")
local buyItemEvent = events:WaitForChild("BuyItem")
local playerGui = player:WaitForChild("PlayerGui")
local function getBucksAmount()
local success, bucksLabel = pcall(function()
return playerGui:WaitForChild("Menew"):WaitForChild("ShopButtons"):WaitForChild("Bucks"):WaitForChild("Bucks")
end)
if not success or not bucksLabel then
return 0
end
local text = bucksLabel.Text:gsub("[^%d]", "")
local amount = tonumber(text)
return amount or 0
end
local Price = {
SKIN_CRATE_PRICE = 900,
MELEE_CRATE_PRICE = 900,
FLAIR_CRATE_PRICE = 600,
CARD_CRATE_PRICE = 600,
UNUSUAL_CRATE_PRICE = 25000,
WINTER_CRATE_PRICE = 2500,
HALLOWEEN_CRATE_PRICE = 2500,
}
local function tryBuyCrate(crateName)
local bucks = getBucksAmount()
if crateName == "Skin Crate" and bucks >= Price.SKIN_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Skin Crate" })
elseif crateName == "Melee Crate" and bucks >= Price.MELEE_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Melee Crate" })
elseif crateName == "Flair Crate" and bucks >= Price.FLAIR_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Flair Crate" })
elseif crateName == "Card Case" and bucks >= Price.CARD_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Card Case" })
elseif crateName == "Unusual Crate" and bucks >= Price.UNUSUAL_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Unusual Crate" })
elseif crateName == "Winter Crate" and bucks >= Price.WINTER_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Winter Crate" })
elseif crateName == "Halloween Crate" and bucks >= Price.HALLOWEEN_CRATE_PRICE then
buyItemEvent:FireServer({ "BuyItem", "Crate", "Halloween Crate" })
end
end
--// Example usage:
tryBuyCrate("Skin Crate")
Comments
Please, i would appreciate it, especially the summer 2021
can you make one for delta, and if possible, the halloween, winter and summer 2021 crates, nad also the contract shop from halloween 2021, ofc if possible