Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Not sure how to make this gamepass prompt work? No errors and just not working!

Asked by 5 years ago

So basically I want it to prompt a game pass purchase then simply change a value. When it prompts the game pass purchase it prompts some random game pass and does not work? Please help me, Here is the code!

local id = 5242880
 local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
 if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,id) then
  game.Workspace.Middle.Value = true
    else
      game:GetService("MarketplaceService"):PromptPurchase(player, id)
       script.Parent.Parent.Status.Text = "In order to be a Middle rank you need to buy the gamepass."
wait(7)
 script.Parent.Parent.Status.Text = ""


    end
end)
0
You use PromptGamePassPurchase to prompt game pass purchases. User#19524 175 — 5y
0
Additionally, you should check if they own the game pass on the server, using remotes, as well as using UserOwnsGamePassAsync instead of PlayerOwnsAsset as game passes are no longer assets. They are now their own category, and the arguments to UserOwnsGamePassAsync are: UserId, GamePassId. Instead of the player object you'd pass their UserId. User#19524 175 — 5y
0
On line 7, instead of "game:GetService("MarketplaceService"):PromptPurchase(player, id)", do game:GetService("GamepassService"):PromptGamePassPurchase(player, id) toman655 58 — 5y

1 answer

Log in to vote
-1
Answered by 5 years ago

I have had problems in the past with local variables. Change local is to just id to make it global. They are actually faster because the script needs to read each letter 1 by 1 so it's slow for the script. Also try not to space out the code because it has to read the spaces making it even slower and harder for the script

Ad

Answer this question