Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gamepass Gui Purchase Button Not Working?

I tried using a tutorial on yt on how to make a gui that when pressed, gives the player an option to buy a gamepass. its not working tho. I put the script inside a textbutton, which is inside a screen gui. "Give" Is a remote event in rep store. pls help.

local mps = game:GetService("MarketplaceService")
local gamepass_id = ______

script.Parent.MouseButton1Click:Connect(function()
 local player = game.Players.Localplayer
 mps:PromptGamePassPurchase(player, gamepass_id)
end)

mps.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
 if id == gamepass_id and purchased then
  game.ReplicatedStorage.Give:fireserver()
 end
end)

maybe its outdated?

2 comments

0

Use :FireServer() instead of :fireserver().

0

This wouldn't work because you need to connect a remote function to a remote event

1 answer

local mps = game:GetService("MarketplaceService")
local gamepass_id = ______ -- your id here

script.Parent.MouseButton1Click:Connect(function()
 local player = game.Players.Localplayer
 mps:PromptGamePassPurchase(player, gamepass_id)
end)

mps.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
 if id == gamepass_id and purchased then
  game.ReplicatedStorage:FireServer()
 end
end)

2 comments

0

nope, not working...

0

maybe try :FireAllClients()

This discussion is preserved as it was. New answers, comments, and votes are closed.