GUI Imagebutton not working

Im trying to code my GUI to prompt a gamepass when you click an imagebutton, I copied this code from an earlier game I made where it works absolutely fine with the only difference between the 2 guis been that 1 uses an imagebutton (broken one) and the older working one uses a textbutton

code:

image

explorer:
image

zindex of purchase imagebutton (highst in the enitre gui):
image

theirs absolutely 0 errors in the output so im not sure what the issue is

2 Likes

Put player in the function that might work

local plr = game.Players.LocalPlayer
local GPS = game:GetService("GamePassService")
local MPS = game:GetService("MarketplaceService")

local buy_1 = script.Parent.Admin.Purchase

buy_1.MouseButton1Down:Connect(function()
	MPS:PromptGamePassPurchase(plr,18686596)
end)

This code seems to work. You used GamePassService instead of MarketPlace.

1 Like

If you put it in the function it will auto complete

so ```

local GPS = game:GetService("GamePassService")
local MPS = game:GetService("MarketplaceService")

local buy_1 = script.Parent.Admin.Purchase

buy_1.MouseButton1Down:Connect(function(player)
	MPS:PromptGamePassPurchase(player,18686596)
end)

Yes, but as I said, he was using GPS, instead of MPS.

tried this still no luck, no errors in output again but just no prompt at all

also tried the most recent one coderbanana sent still no luck

Oh okay thanks for clarifying I don’t really get the difference tho om just dumb

Perhaps you should use a different gamepassID, and use a LocalScript.

Did you change things or copy and past

You might have to edit it because the things might not be the same

straight copy and paste bar changing the location to the imagebutton

Make a LocalScript inside the button and use the code.

1 Like

tried that still no luck,
this is the code i used
image
and this is the explorer
image

are you sure its MPS and not GPS

not sure what that means to be totally honest

I revised, now this seems to work Properly!

local plr = game.Players.LocalPlayer
local GamePass = game:GetService("GamePassService");
local Market = game:GetService("MarketplaceService");

script.Parent.MouseButton1Down:Connect(function()
	Market:PromptGamePassPurchase(plr,18686596)
end)
1 Like

still no luck unfortunately no prompt or anything again

Make sure this is on?

1 Like

It has to be something whit your studio I tested and it works

1 Like