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

Make a brick promt you to buy a gamepass?

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?

1 comment

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.

2 answers

✓ Accepted answer

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)

3 comments

0

Pretty sure this wouldn’t work assuming the localscript is in the workspace and the arg order is plr, gamepassid

0

Yeah probably wouldn't work because its a localscript, gonna edit it.

0

Also make sure you close the function with a parenthesis after the end

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)

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