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

Why is gui button "disabled" when clicked?

Asked by 2 years ago

When I try to click the button with this code it does nothing it breaks when I add the

game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, 90390025)

part, which I was told to use instead of PromptPurchase which works but doesnt let you buy the gamepass.

local btn = script.Parent

local isHovering = false

btn.MouseEnter:Connect(function()

    isHovering = true

    btn:TweenSize(UDim2.new(1.03, 0, 1.091, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
end)

btn.MouseLeave:Connect(function()

    isHovering = false

    btn:TweenSize(UDim2.new(1, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
end)

btn.MouseButton1Down:Connect(function()

    btn:TweenSize(UDim2.new(0.97, 0, 0.909, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
    game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer, 90390025)
end)

btn.MouseButton1Up:Connect(function()

    if not isHovering then
        btn:TweenSize(UDim2.new(1, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
    else
        btn:TweenSize(UDim2.new(1.03, 0, 1.091, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
    end
end)

Answer this question