Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making a script that allows a player to view a gui after buying a free decal or model?

Asked by
Sxerks3 65
9 years ago

So, I am making a gui menu of different missions. How would you write a script that allows a player to view a gui (ie. make it visible) upon purchasing a free decal or model? The reason I'm not using GamePass is that it's not "free", and I'm using the TeleportService script to teleport players into the missions, so having a "Touched" brick function wouldn't work (if so, how would I do so).

Can I use the "GamePassService", or do I have to use the "MarketplaceService"?

0
Marketplace service will work just fine, just make sure it's in a normal script and just wait for the receipt NotSoNorm 777 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

The following code should work:

local market = game:GetService("MarketplaceService")
local g = script.Parent
local player = game.Players.LocalPlayer

local assetId = 00000

-- insert event that triggers 'market:PromptPurchase(player,assetId)'
-- e.g 'script.Parent.MouseButton1Down:connect(function()'

while true do
    local check = market:PlayerOwnsAsset(player,assetId)
    if check and g.Visible == false then
        g.Visible = true
    end
    wait(1)
end

Note: To find the LocalPlayer instead of using script.Parent.Parent etc., this script needs to be a LocalScript

For more info on MarketplaceService etc.: http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService

Ad
Log in to vote
0
Answered by 9 years ago

GamePassService is just for gamepasses. Use the MarketplaceService.

Answer this question