When i put the "Id = 1233299147;" i got this error ` " MarketplaceService:getProductInfo() failed because HTTP 400 (BadRequest) Stack Begin
Script 'Players.pukinginakatalaga.PlayerScripts.Main.Shops.Premium', Line 109 - function Build
Script 'Players.pukinginakatalaga.PlayerScripts.Main.Shops.Premium', Line 152 Stack End"`
local References = require(game:GetService("ReplicatedStorage").Utilities.Services.References) local Utilities = References.Utilities local Services = Utilities.Services local Fireworks = require(Services.ServerScripts.Main.Fireworks) local Backpacks = require(Services.ServerScripts.Main.Backpacks) local Player = require(Services.ServerScripts.Main.Player) local Crystals = require(Services.ServerScripts.Main.Crystals) local Temporary = require(script.Temporary) local Premium = {} function Premium:CheckProductCategory(id) local firework_show_name = References.SharedData.Fireworks.RespawnProductIds[id] local currency_name = References.SharedData.Premium:DataById(id, "Currency") local temporary_boost_name = References.SharedData.Premium:DataById(id, "Temporary") local item_name = References.SharedData.Premium:DataById(id, "Items") local crystal_name = References.SharedData.Premium:DataById(id, "Crystals") --local increase_name = References.SharedData.Premium:DataById(id, "Increase") if firework_show_name then return "Firework Show", firework_show_name elseif currency_name then return "Currency", currency_name elseif temporary_boost_name then return "Temporary", temporary_boost_name elseif item_name then return "Items", item_name elseif crystal_name then return "Crystals", crystal_name -- elseif increase_name then -- return "Increase", increase_name end end Services.Marketplace.ProcessReceipt = function(receipt_info) local player = Services.Players:GetPlayerByUserId(receipt_info.PlayerId) if not player then return Enum.ProductPurchaseDecision.NotProcessedYet; end local po = Player.Players[player] if po then local product_category, product_name = Premium:CheckProductCategory(receipt_info.ProductId) if product_category == "Firework Show" then -- reset player's firework show Fireworks.Shows:ResetShowTaken(po, product_name); return Enum.ProductPurchaseDecision.PurchaseGranted; elseif product_category == "Currency" then local currency_data = References.SharedData.Premium.Currency[product_name] local amount = currency_data.Amount local currency = currency_data.Type po:Reward(currency, amount, true) -- reward the currency, ignoring multipliers. return Enum.ProductPurchaseDecision.PurchaseGranted; elseif product_category == "Temporary" then local product_data = References.SharedData.Premium.Temporary[product_name] if product_data then local val_name = product_data.ValueName local misc_val = po:GetDataValue("Misc", val_name) or po:MakeDataValue("Misc", val_name, 0) misc_val.Value = misc_val.Value + product_data.Amount -- add the time to the value po:UpdateMultipliers() -- update multipliers. if val_name == "Walk Fast Temporary" then References.RemoteEvents.ForceSetting:FireClient(po.Player, "Fast Walk", true) end return Enum.ProductPurchaseDecision.PurchaseGranted; end elseif product_category == "Items" then local product_data = References.SharedData.Premium.Items[product_name] if product_data then for i=1,#product_data.UnlocksItems do local item_data = product_data.UnlocksItems[i] local item_category = item_data.Category local item_name = item_data.Name if item_category and item_name then po:UnlockItem(item_category, item_name, item_data.SetCurrentOnPurchase) return Enum.ProductPurchaseDecision.PurchaseGranted; end end end elseif product_category == "Crystals" then local product_data = References.SharedData.Premium.Crystals[product_name] if product_data then if Crystals.OpenPremium(po.Player, product_data.CrystalType) then return Enum.ProductPurchaseDecision.PurchaseGranted; end end -- elseif product_category == "Increase" then -- local product_data = References.SharedData.Premium.Increase[product_name] -- if product_data then -- local amount = product_data.Amount -- local data_val = po:GetDataValue(product_data.DataCategory, product_data.ValueName) or po:MakeDataValue(product_data.DataCategory, product_data.ValueName, 0) -- data_val.Name = product_data.ValueName -- data_val.Value = data_val.Value + amount; -- return Enum.ProductPurchaseDecision.PurchaseGranted; -- end end end return Enum.ProductPurchaseDecision.NotProcessedYet end function Premium:HandleNewGamePass(po, gamepass_name, gamepass_data) local misc_val = po:GetDataValue("Misc", gamepass_name) or po:MakeDataValue("Misc", gamepass_name, true) misc_val.Value = true if gamepass_data.ForceSetting then References.RemoteEvents.ForceSetting:FireClient(po.Player, gamepass_data.ForceSetting, true) end local is_infinite_multiplier = gamepass_data.IsInfiniteMultiplier local is_item = gamepass_data.UnlocksItems local is_vip = gamepass_name == "V.I.P" if is_infinite_multiplier then po:UpdateMultipliers() -- update the player's current multipliers. if gamepass_name == "Walk Fast" then References.RemoteEvents.ForceSetting:FireClient(po.Player, "Fast Walk", true) end end if is_item then for i=1,#is_item do local item_data = is_item[i] local item_name = item_data.Name; local item_category = item_data.Category; po:UnlockItem(item_category, item_name, item_data.SetCurrentOnPurchase) if item_category == "Backpacks" then Backpacks:Give(po) end end end if is_vip then po:SetChatTags() end end Services.Marketplace.PromptGamePassPurchaseFinished:Connect(function(player, id, was_purchased) if player and id and was_purchased then local po = Player.Players[player] if po then local gamepass_name, gamepass_data = References.SharedData.Premium:DataById(id, "Game Passes") Premium:HandleNewGamePass(po, gamepass_name, gamepass_data) end end end) -- when players join they get processed through this, which will handle gamepasses purchased out of game. function Premium.UpdateGamepassValues(player) if player then local p_data = player:WaitForChild("Data") local misc = p_data:WaitForChild("Misc") local po = Player.Players[player] -- will be valid as we are waiting for player.Data.Misc which is only parented after po is loaded. if po then delay(3, function() for name, data in pairs(References.SharedData.Premium["Game Passes"]) do local player_owns_gamepass = Services.Marketplace:UserOwnsGamePassAsync(player.UserId, data.Id) if player_owns_gamepass then local gamepass_name, gamepass_data = References.SharedData.Premium:DataById(data.Id, "Game Passes") Premium:HandleNewGamePass(po, gamepass_name, gamepass_data) end end end) end end end Services.Players.PlayerAdded:Connect(Premium.UpdateGamepassValues) return Premium