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:

01local market = game:GetService("MarketplaceService")
02local g = script.Parent
03local player = game.Players.LocalPlayer
04 
05local assetId = 00000
06 
07-- insert event that triggers 'market:PromptPurchase(player,assetId)'
08-- e.g 'script.Parent.MouseButton1Down:connect(function()'
09 
10while true do
11    local check = market:PlayerOwnsAsset(player,assetId)
12    if check and g.Visible == false then
13        g.Visible = true
14    end
15    wait(1)
16end

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