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

How to prompt in-game purchase using part touch?

I've been trying to prompt an in-game purchase (a gamepass) when a part is touched, but I've had no luck. Is anyone able to help?

script.Parent.Touched:Connect(function(hit)
	game.MarketplaceService:PromptGamePassPurchase(hit.Parent, 1011622680)
end)

1 answer

PromptGamePassPurchase requires the player, not the character. You could, however, use :GetPlayerFromCharacter to get the player.

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	game.MarketplaceService:PromptGamePassPurchase(player, 1011622680)
end)

(Link)

1 comment

0

Mark this as correct.

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