Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Purchase button doesn't work as intended. Help?

Asked by 7 years ago
Edited 7 years ago

I'm trying to make a button that prompts a gamepass purchase if a Image is set to a certain image. However, i'm trying to make them work with 2 prompts inside 1 local script, and it simply doesn't work except the 2nd one which for some reason works.

Here's the code:

local player = game.Players.LocalPlayer
local id1 = 614767982
local id2 = 616058590
local icon = .Parent.Parent.GamepassLogo

script.Parent.MouseButton1Down:connect(function()
    if icon.Image == "rbxassetid://170783147" then
    game:GetService("MarketplaceService"):PromptPurchase(player, id1)
    elseif icon.Image == "rbxassetid://281358588" then
    game:GetService("MarketplaceService"):PromptPurchase(player, id2)
    end
    end)

Answer this question