Im trying to make a Gui that you can click on and you can buy something. It is a regular script and a Textbutton inside a ScreenGui, inside the StarterGUI. The script is...
local assetId = 27112438 --Insert any object Id script.Parent.TextButton.MouseButton1Down:connect(function(player) --If true connect the function player Game:GetService("MarketplaceService"):PromptPurchase(player, assetId) end)
The player is not passed as an argument when the MouseButton1Down
event fires.
local assetId = 27112438 --Insert any object Id local player = script.Parent.Parent.Parent while not player:IsA("Player") do player = player.Parent end --Keep going up until we find the player script.Parent.TextButton.MouseButton1Down:connect(function() game:GetService("MarketplaceService"):PromptPurchase(player, assetId) end)
local bloxyColaId = 164625523--id of product or gamepass if its produt, its productid local player = game.Players.LocalPlayer function onClick() Game:GetService("MarketplaceService"):PromptPurchase(player, bloxyColaId) end script.Parent.MouseButton1Click:connect(onClick) --this goes in a local script