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

Make a brick promt you to buy a gamepass?

Asked by 4 years ago

Hello. I've recently been trying to get a script that allows a player to buy a gamepass if they step on a certain brick

I know it has to include

game:GetService("MarketplaceService"):PromptGamePassPurchase

Or something like that, its just when i'm trying to get it work when you step on a brick, Does anyone know a working script?

0
You could use the Touched event of the brick to prompt it, something like part.Touched:Connect(function(hit) local player = game:GetService(“Players”):GetPlayerFromCharacter(hit.Parent) end) And just prompt the player found from it to buy the gp. msuperson24 69 — 4y

2 answers

Log in to vote
2
Answered by
BashGuy10 384 Moderation Voter
4 years ago
Edited 4 years ago

Hi, i'm BashGuy10. Hopefully i can help you!

Problem?

You don't know how to make a brick prompt you to buy a gamepass?

Fixes

It's really simple, just do :PromptGamePassPurchase(plr, gamepassid) . Also if it doesn't work use :PromptGamePassPurchase(gamepassid, plr)

Some info: plr, is the player instance. gamepassid is the string of numbers found in the URL for the gamepass.

Here are some link to help you out:

:PromptGamePassPurchase(plr, gamepassid)

MarketplaceService

Example Fix

By the way, this is a server script. k

local gamepassid = 0 -- ID Here

script.Parent.Touched:Connect(function(hit)
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
    -- Code here
end)

0
Pretty sure this wouldn’t work assuming the localscript is in the workspace and the arg order is plr, gamepassid msuperson24 69 — 4y
0
Yeah probably wouldn't work because its a localscript, gonna edit it. BashGuy10 384 — 4y
0
Also make sure you close the function with a parenthesis after the end msuperson24 69 — 4y
Ad
Log in to vote
0
Answered by
ghxstlvty 133
4 years ago

Try this script!

script.Parent.Touched:connect(function(hit)
 if hit.Parent:FindFirstChild("Humanoid") then
  game.Players.LocalPlayer.PlayerGui.guiname.Frame.Visible = true
 end
end)

Answer this question