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"?
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