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

How to make a open/close Text button GUI into a gamepass ?

So this is what i mean by it. Is like when you click on the button it asks you to buy the gamepass before getting into the GUI then it opens.

I tried my best but this is my result

https://gyazo.com/01eaf3905aa7503fc398f35e968728c8

Script that i made

script.Parent.MouseButton1Down:connect(function() script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible end) local player = game.Players.LocalPlayer local id = 884659792 game:GetService("MarketplaceService"):promptPurchase(player, id) end)

2 comments

0

nice block code :D

0

first make another gui and put the gamepass code in that gui's text button

1 answer

✓ Accepted answer

You have already asked this question before, and I have already answered it. You can find the question right here -- However, here is a more updated code, because now I know where your buttons are located so that I can make the entire script. For guidance, go to my previous answer. Here is the same code as last time, but completed because I know where the frame is:

-- local script inside the button
local allow = false
local Player = game.Players.LocalPlayer
if game.MarketplaceService:PlayerOwnsAsset(Player,773709832) then -- checks if he has it, again, replace the id
    allow = true -- sets a variable to true
end
--( they will have to reset after purchasing the gamepass)
script.Parent.MouseButton1Down:Connect(function()
    if allow then-- if they have it, do which ever you want
script.Parent.Parent.Frame.Visible = true -- here is your new line.
    else -- if they do not have it, ask them to purchase
        game.MarketplaceService:PromptPurchase(Player, 773709832) -- change the number to the ID of the gamepass, found in its link of your gamepass
    end
end)

3 comments

0

Ok Thanks. This really helped me, it did a lot! But when i click in the Gui button it doesnt close any idea ?

0

never mind, I made it my self script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible

0

mhm. I thought an x button might be in your gui. If you want me to make it close as well, I could do that

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