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
Youf_Dev
(Youf_Dev)
September 16, 2023, 8:17am
#3
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
jukepilot
(Juke)
September 16, 2023, 8:28am
#4
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
Youf_Dev
(Youf_Dev)
September 16, 2023, 8:40am
#5
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.
Canonically, you should be prompting purchases from the client and the server can if it needs to. As far as using the prompt finished events, they can also be used by both the server and the client, your needs will change depending on what exactly it is you’re doing.
Since your thread is vague about what specifically you’re doing and is just a Q&A, can’t exactly give a proper answer as to “should this be client-sided or server-sided”.
Exploiters are a non-concern at all here as far as internal…
4 Likes
would you be able to make a code for me ?
1 Like
Youf_Dev
(Youf_Dev)
September 16, 2023, 8:50am
#7
I already did on my first post on this topic, but here it is again
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
Youf_Dev
(Youf_Dev)
September 16, 2023, 8:55am
#9
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
Youf_Dev
(Youf_Dev)
September 16, 2023, 9:01am
#11
Can you show the explorer of where the “GamepassID” is? Also make sure that you put the correct gamepassID
4 Likes
Do you have any idea how to fix this problem becausei need it so much to be fixed
1 Like
mpc19801981
(mpc19801981)
September 16, 2023, 9:16am
#14
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
mpc19801981
(mpc19801981)
September 16, 2023, 9:18am
#16
Can you check name of instance?
1 Like
Where do i check that i am quiet new.
1 Like
Youf_Dev
(Youf_Dev)
September 16, 2023, 9:19am
#18
do you have a gamepassID? if yes could you send it to us?
2 Likes
mpc19801981
(mpc19801981)
September 16, 2023, 9:19am
#19
Check GamepassID name like if it is the same.
1 Like
Here you go thats my gamepass id 255612370
1 Like