THE SCRIPT: local assetid = "ID OF THE PRODUCT"
local cd = script.Parent.ClickDetector
cd.MouseClick:connect(function(player)
game:GetService("MarketplaceService"):PromptPurchase(player,assetid)
end)
Please help...
A localscript inside the textbutton
local MarketplaceService = game:GetService("MarketplaceService") local function onMouseClick (Player) local AssetId = tonumber(Player.PlayerGui.ScreenGui.AssetId.Text) MarketplaceService:PromptProductPurchase(Player, AssetId) end script.Parent.ClickDetector.MouseClick:Connect(onMouseClick)
A server script inside the serverscriptservice
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") local function OnServerEvent (Player, AssetId) Player.PlayerGui.ScreenGui.AssetId.Text = AssetId print(Player.PlayerGui.ScreenGui.AssetId.Text) end RemoteEvent.OnServerEvent:Connect(OnServerEvent)
A localscript inside the textbox
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") local function InputEnded () RemoteEvent:FireServer(script.Parent.Text) end script.Parent.InputEnded:Connect(InputEnded)