I have this in SurfaceGui.Frame then inside frame, I have the image button. Am I doing something wrong? I does work in regular GUI. but when I put it into surface GUI, it doesn't work.

I can't click on the button and trigger the service.

local player = game.Players.LocalPlayer
local a = script.Parent  
local click = script:WaitForChild('click')
local donation = {a:WaitForChild('donate1'), a:WaitForChild('donate2'), a:WaitForChild('donate3'), a:WaitForChild('donate4'), a:WaitForChild('donate5'), a:WaitForChild('donate6')}

donation[1].MouseButton1Down:connect(function()
	    click:Play()
		game:GetService("MarketplaceService"):PromptPurchase(player, 610567902)--5
	    end)
	
donation[2].MouseButton1Down:connect(function()
		click:Play()
		game:GetService("MarketplaceService"):PromptPurchase(player, 610568306)--15
        end)

donation[3].MouseButton1Down:connect(function()
		click:Play()
		game:GetService("MarketplaceService"):PromptPurchase(player, 610568669)--50
	    end)

donation[4].MouseButton1Down:connect(function()
		click:Play()
		game:GetService("MarketplaceService"):PromptPurchase(player, 610568976)--100
		end)

donation[5].MouseButton1Down:connect(function()
		click:Play()
		game:GetService("MarketplaceService"):PromptPurchase(player, 289466449)--500
		end)

donation[6].MouseButton1Down:connect(function()
		click:Play()
		game:GetService("MarketplaceService"):PromptPurchase(player, 289465496)--1000
		end)

3 comments

0

make sure all the frames and surfacegui have the active property enabled

0

Is the SurfaceGui in a part or StarterGui? The SurfaceGui needs to be in StarterGui or PlayerGui and have its adornee in properties set to the part to be interactable.

0

Its in a part. How to do I do that?