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

What is wrong with this t Shirt Purchase GUI Script ? Works in Studio not Online?

Here is the code i made in about 5 minutes but idk why the script works in studio so i thought it would work and then i play online and it does not work there...

t is the button f is another button h is another Basically want it so when i click one of the buttons it opens up the purchase screen these are donations t = 20 R$ f = 40 R$ h = 100 R$

please help thank you.

local t = script.Parent.twenty
local f = script.Parent.fourty
local h = script.Parent.hundred
local player = game.Players.LocalPlayer

t.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(player,458603953)
end)

f.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(player,458604263)
end)

h.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(player,458604408)
end)

1 comment

1 answer

local t = script.Parent.twenty
local f = script.Parent.fourty
local h = script.Parent.hundred
local player = game.Players.LocalPlayer

t.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptPurchase(player,458603953)
end)

f.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptPurchase(player,458604263)
end)

h.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptPurchase(player,458604408)
end)


"game:GetService('MarketplaceService'):PromptPurchase" CANNOT be used in a LocalScript. Use a Server Script instead. :)

2 comments

0

I can use server scripts in gui's i thought i couldn't

0

You can. If this worked for you, please use the "Accept Answer" button.

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