Prompt GamePass purchase doesn't work

Can anyone help me with this script I been trying alot but this doesn’t work and I am trying to make shop so you click on item and you can buy.
This is the script:

local mps = game:GetService(“MarketplaceService”)

script.Parent.MouseButton1Click:Connect(function()

mps:PromptGame Pass Purchase (game.Players.LocalPl ayer,script.Parent.GamepassID.Value) end)

6 Likes

MarketplaceService is only available on the server. You must use remote events for this

2 Likes

First of all, make sure it’s a localScript. Then check the path to script.Parent.GamepassID.Value and make sure the GamepassID is correct. Also, I don’t understand why you have unnecessary spaces between your code. It’s PromptGamePassPurchase and not PromptGame Pass Purchase for example.

local mps = game:GetService(“MarketplaceService”)

script.Parent.MouseButton1Click:Connect(function()
	mps:PromptGamePassPurchase(game.Players.LocalPlayer, script.Parent.GamepassID.Value) 
end)

@neweve2323 That’s false, MarketplaceService is available on the client aswell. Some events of mps can only be used on the server tho, such as PromptPurchase.

2 Likes

PromptGamePassPurchase is only available on the server. and prompting it would look something like this:

Client:

script.Parent.MouseButton1Click:Connect(function(player)
RemoteEvent:FireServer(player, script.Parent.GamepassID.Value)
end)

Server:

local MarketplaceService= game:GetService(“MarketplaceService”)

RemoteEvent.OnServerEvent:Connect(function(player, id)
mps:PromptGamePassPurchase(player, id)
end)
3 Likes

Where did y’all learn to script? I’ve been using PromptGamePassPurchase on the client for every shop system i made and i’ve never encountered a problem. You should use it on the server if you have really have to, but else I don’t see why.

4 Likes

would you be able to make a code for me ?

1 Like

I already did on my first post on this topic, but here it is again :wink:

local mps = game:GetService(“MarketplaceService”)

script.Parent.MouseButton1Click:Connect(function()
	mps:PromptGamePassPurchase(game.Players.LocalPlayer, script.Parent.GamepassID.Value) 
end)
1 Like

Do you have discord beacuse i wanna talk about it beacuse it dosent work for me.
Image :


2 Likes

Try this:

local mps = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function()
	mps:PromptGamePassPurchase(game.Players.LocalPlayer, script.Parent.GamepassID.Value) 
end)
3 Likes

Thanks there is no errors but it dosen’t show do you want to buy the purchase

3 Likes

Can you show the explorer of where the “GamepassID” is? Also make sure that you put the correct gamepassID

4 Likes


image

1 Like

Do you have any idea how to fix this problem becausei need it so much to be fixed

1 Like

Try this:

local mps = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function()
	mps:PromptGamePassPurchase(game.Players.LocalPlayer, script.Parent:WaitForChild("GamepassID").Value) 
end)
1 Like

1 Like

Can you check name of instance?

1 Like

Where do i check that i am quiet new.

1 Like

do you have a gamepassID? if yes could you send it to us?

2 Likes

Check GamepassID name like if it is the same.

1 Like

Here you go thats my gamepass id 255612370

1 Like