RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a random price item script using Bedwars scripting docs"
-- server script local MarketplaceService = game:GetService("MarketplaceService") local itemId = math.random(1, 100) -- Assumes item IDs are between 1 and 100 MarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased) if isPurchased and assetId == itemId then local leaderstats = player:FindFirstChild("leaderstats") if leaderstats then local coins = leaderstats:FindFirstChild("Coins") if coins then coins.Value = coins.Value + 100 -- Increase coins by 100 end end end end) local function onButton1Click(player) MarketplaceService:PromptPurchase(player, itemId) end game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(onButton1Click)