Issue with buying gamepass for frame to show

So, I’m making a purchase button to make a frame show that normal players who haven’t bought the gamepass cant see the output says nothing and here is the codes:

Gamepass Handler code:

game.ReplicatedStorage.GamePassNeed.Gui.OnClientEvent:Connect(function(plr)
local clonebutton = game.ReplicatedStorage.GamePassNeed.ShowButton:Clone()
clonebutton.Parent = script.Parent
end)

that script is located in a gui named MainGui

This next script is located in the button its self the buttons name is PurchaseButton

local plr = game.Players.LocalPlayer
local gamepassId = 80416384

script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(plr, gamepassId)
end)

that code is called the Handler and in a Folder called GamePassNeed is a RemoteEvent called Gui there is also a frame in the folder named ShowButton

can you put a print line inside every script then control that do they work

I’m a new coder like print(Worked) and ontop of bottom of each script

what is the output ?
and can you send a photo of the explorer ?

Nothing in output and ok here it is

so u put print lines then there was no output ?

this means scripts are not working

I have not put print lines but ill do that real quick

you are trying to GetService("MarketPlaceService") inside a local script, you should use a server script for it.

you cannot use MarketPlaceService inside a localScript

When changing the script from local to normal this happened >MarketplaceService:PromptGamePassPurchase() player should be of type Player

and seems like you used OnClientEvent(player) and that makes no sense, i suggest you to learn basics of scripting, before making games, you can search in the internet about RemoteEvents and MarketPlaceService

I used a YouTube tutorial for this

you did the same what he did and did not work ?

yeah ill link you the video I used

can you send me the code which you fire the client ?

As in to prompt the gamepass if so its this

local plr = game.Players.LocalPlayer
local gamepassId = 80416384

script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(plr, gamepassId)
end)

but in this script you just PromptPurchase, control the script in the video, you did not FireClient()

there is no… FireClient()

char limit

listen I’m going to have to go for now but when I can i will respond to your post

like i said in my one of the answers, you must learn the basics first, look at roblox Developer Hub and read the document about MarketPlaceService.

sorry, i cannot help you :frowning:

1 Like